SANTA CLARA, Calif. -- Nick Novak kicked a 40-yard field goal 4:54 into overtime on Saturday night, capping a San Diego comeback and providing the Chargers a 38-35 victory over the San Francisco 49ers.
The 49ers (8-7), who lost their fourth straight, were officially eliminated from the NFC postseason chase last week.
The Chargers scored the game's final 17 points, rallying into a 35-all tie on Rivers' fourth touchdown pass of the game, an 11-yarder to wide receiver Malcom Floyd with 29 seconds remaining in the fourth quarter. The connection capped a 14-play, 80-yard drive.
Rivers earlier hooked up with tight end Antonio Gates from 21 yards, their second touchdown connection, to get San Diego within 35-28 with 5:15 remaining.
Wideout Eddie Royal caught 10 passes for 94 yards and a touchdown, and Gates had seven receptions for 92 yards and two scores for the Chargers, who were playing without running back Ryan Mathews (ankle) and wide receiver Keenan Allen (collarbone).
After the Chargers had sliced a 21-point halftime deficit to 28-21 on Rivers' second TD pass and a defensive score, 49ers quarterback Colin Kaepernick appeared to stymie the San Diego comeback when he escaped a pass rush and sprinted 90 yards up the middle of the field for a touchdown with 2:26 left in the third quarter.
Kaepernick finished with 151 rushing yards on seven carries and running back Frank Gore 158 yards on 26 carries, giving the 49ers their first pair of 100-yard rushers in the same game since 1977.
Niners kick returner Bruce Ellington took advantage of additional offensive playing time brought about by injuries to wideouts Michael Crabtree, Stevie Johnson and Brandon Lloyd to score on an 8-yard pass and a 1-yard run in the second quarter as the 49ers extended a 7-0 advantage to 28-7 by halftime.
Gore scored on a 52-yard run, his longest since 2011, and safety Antoine Bethea had his first career touchdown on a 49-yard interception return as the 49ers scored more points in the first half (28) than their total in their previous three defeats (23).
It wasn't enough.
Defensive tackle Corey Liuget recovered a Kaepernick fumble in the end zone in the third quarter to contribute to the San Diego comeback.
The 49ers' early lead could have been even greater if not for a mistake in the red zone on their second possession.
After Gore's 52-yard touchdown on its first possession had given San Francisco a 7-0 lead, the 49ers appeared on the verge of going up 14 before fullback Bruce Miller fumbled at the San Diego 1-yard line after a hard hit by Chargers safety Marcus Gilchrist. Liuget recovered for San Diego on the 5.
But that only served to delay the score by three plays, as 8- and 6-yard runs by Gore and Kaepernick, respectively, set up an 8-yard touchdown pass from Kaepernick to Ellington for a 14-0 lead in the second minute of the second quarter.
Bethea's interception return on a pass intended for Gates came seven plays later, making it 21-0 with still 10:20 left in the half.
The Chargers got on the board when Rivers threw a 15-yard touchdown pass to Royal with 5:09 left in the half, trimming the San Francisco lead to 21-7.
But the 49ers countered that with Ellington's second touchdown, a 1-yard scamper on a reverse, to make it a three-touchdown lead again with just six seconds left in the half.
Gore already had a season-high 129 yards on 14 carries by halftime.
NOTES: S Antoine Bethea's interception return for a touchdown was the 49ers' third defensive score of the season. DB Chris Culliver (fumble return) and DB Dontae Johnson (interception return) had the previous two. … RB Frank Gore's previous long touchdown run this season had been just 10 yards. RB Carlos Hyde had the team's longest touchdown run before Saturday, two 28-yarders. … Gore's 100-yard day was his third of the season and first since a 107-yard effort in Week 5 against Kansas City. His previous single-game high was 119 yards in Week 4 against Philadelphia. … Before the game, the 49ers placed their leading tackler, ILB Chris Borland, on injured reserve with an ankle injury. LB Chase Thomas was activated from the practice squad to take Borland's place on the active roster.