Donald Strickland returned a blocked field goal 41 yards for a touchdown on the final play of the first half for the 49ers (2-4), who went ahead 26-17 in the third quarter. They couldn't sustain that momentum in their third straight loss against a Philadelphia defense that repeatedly made stunning plays in the final minutes.
After David Akers' 38-yard field goal put Philadelphia (3-3) ahead with 7:46 to play, Quintin Mikell's interception return to the San Francisco 7 set up another short field goal. Trent Cole then swatted the ball out of J.T. O'Sullivan's hands, and Chris Clemons recovered to set up another field goal with 1:10 left.
San Francisco got past midfield with one last drive, but O'Sullivan threw a pass directly to Juqua Parker, who returned it 55 yards for a score with 38 seconds left.
Correll Buckhalter rushed for 93 yards and a touchdown while filling in for injured All-Pro Brian Westbrook. The Eagles also played without injured receivers Kevin Curtis and Reggie Brown.
McNabb barely seemed affected while going 23-for-36, easily racking up the 12 pass attempts and 264 yards passing he needed to pass Ron Jaworski atop the Eagles' career list in both categories.
DeSean Jackson, the electric Eagles rookie who starred at Cal across the Bay last fall, had six catches for 98 yards. Hank Baskett and L.J. Smith caught TD passes as the Eagles avoided falling further out of the race in the tough NFC East.
O'Sullivan passed for 199 yards and Frank Gore rushed for 101 and a score for the 49ers, who fell to 1-3 at home in another mistake-filled performance that included 10 penalties. Joe Nedney kicked four field goals when the offense repeatedly stalled - until the fourth quarter, when it completely fell apart.
Philadelphia added three sacks to its league-leading total, while holding the Niners to just one offensive touchdown.
Eagles coach Andy Reid won his 99th career game, but he also added another incident to his long history of debatable game management. He elected to try a 54-yard field goal 1 second before halftime. Ray McDonald went unblocked through the line and swatted down the attempt by Akers, who hasn't made a kick longer than 44 yards in his last 10 attempts since Sept. 30, 2007.
Strickland easily returned it for a score, sending San Francisco to the locker room trailing just 17-16. The momentum shift extended into the second half, when the 49ers quickly drove 78 yards for Gore's 6-yard TD run.
Smith caught a 2-yard TD pass from McNabb with 11:38 to play, and Akers added a field goal moments later to put the Eagles ahead 27-26. Egged on by his players, 49ers coach Mike Nolan challenged the call, thinking the kick missed, but replays showed nothing remotely conclusive on a kick that sailed higher than the goalposts.