Updated

Colin Kaepernick threw for 216 yards and four touchdowns as the San Francisco 49ers managed to fend off a late comeback and post a 41-34 victory over the New England Patriots on a cold and rainy Sunday night at Gillette Stadium.

Kaepernick completed 14-of-25 passes, fumbled four times and was picked off once, but it was enough for the 49ers (10-3-1), who have won four of their last five games and clinched a playoff berth in the process.

"It was raining the entire game, but he did a nice job powering the ball through the elements and through the defense at times," San Francisco Jim Harbaugh said about Kaepernick.

Michael Crabtree paced the offense with 107 yards and two scores on seven receptions. Randy Moss and Delanie Walker each had a TD grab, while Frank Gore added 83 yards on 21 carries.

Tom Brady completed 36 passes on a career-high 65 attempts for 443 yards and one touchdown, but was intercepted twice as the Patriots (10-4) rallied from a 28-point second-half deficit but saw their seven-game win streak come to a halt.

Brandon Lloyd and Aaron Hernandez each posted 10 catches, with the former racking up 190 yards and the latter totaling 92 yards and one score. Danny Woodhead posted two TDs on the ground en route to 61 yards on 12 carries.

Woodhead's 6-yard scoring plunge with less than six minutes left in the third quarter pulled the hosts within 31-10, and the defense held the visitors on the ensuing series.

Aided by a 41-yard completion to Michael Hoomanawanui to the Niners' 3-yard line, the Pats climbed within 31-17 as Brady plunged in from the one on 3rd- and-goal on the first play of the fourth quarter.

A pass interference call on the Patriots' first full possession of the fourth set the hosts up on the San Francisco 5-yard line, and Brady connected with Hernandez on the next play to make it 31-24 with 12:13 to go.

Having forced a punt from the 49ers, New England then marched 92 yards in seven plays and Woodhead rolled in from the one with 6:43 left to forge a 31-31 deadlock.

After a 62-yard kickoff return by LaMichael James, Kaepernick found Crabtree on the first play from scrimmage for a 38-yard score and 38-31 lead.

An exchange of punts followed, leaving the Patriots in the shadow of their own goal line. In a controversial move, Brady passed on 4th-and-1 from his own 12- yard line and the pass was well over Woodhead's hands with 2:20 on the clock.

David Akers finished the ensuing series with a 28-yard field goal to give San Francisco a 41-31 edge with 1:56 to play, but Stephen Gostkowski countered from 41 yards away with 38 seconds showing for a seven-point contest.

The onside kick fell into enemy hands and one kneel was able to run off the remaining time.

"We hung in there. We battled back from a 28-point deficit, but we just made too many mistakes when we needed to make the plays. It's a tough loss," said Brady.

It was a sloppy game from the outset due to near-freezing temperatures and a steady rain which created slick conditions.

Pats running back Stevan Ridley lost a fumble on the second play from scrimmage, but the call was reversed on a brief review. Ridley was then stuffed for a loss on 3rd-and-1 and the hosts were forced to punt.

San Francisco turned that into the game's first score as Kaepernick lofted a ball into the end zone, where Moss came down with it for a 24-yard touchdown.

Later in the opening quarter, Brady was picked off by Carlos Rogers and returned the ball 53 yards to the Pats' 5-yard line, but two plays later Walker fumbled and the ball was recovered by Aqib Talib in another play upheld by review.

New England went three-and-out, then San Francisco gambled on 4th-and-10 with a fake punt and won as Dashon Goldson gained 31 yards on the trick play. Akers later pushed a 39-yard attempt wide left.

On the ensuing series, Shane Vereen coughed up the ball, which was recovered by Niners defensive back Chris Culliver at the hosts 34, but New England got it right back as Kaepernick fumbled the snap on a 4th-and-1 from the 25 on the first play of the second quarter.

Gostkowski converted a 32-yard attempt to close out that 16-play series to get the Pats within 7-3.

Aided by a pass interference call on Talib on the following series, the Niners went up 14-3 as Walker hauled in a 34-yard heave by Kaepernick.

More controversy ensued as it appeared Ted Ginn Jr. muffed a punt that was eventually recovered by New England. A lengthy review determined there was no touch, and a challenge from Pats head coach Bill Belichick did nothing to reverse the call.

Eventually, a 20-yard Akers field goal capped that series and San Francisco headed to halftime up 17-3.

Devin McCourty intercepted a pass in the end zone on the Niners' opening drive of the second half, but the effort went for naught as Ridley had the ball stripped away and it was recovered by Goldson for a 66-yard run to the Patriots' six.

A personal foul penalty on the hosts pushed the ball to the three. On the next down, Kaepernick fumbled a handoff, but the delay opened a hole up the middle after Gore recovered and he walked into the end zone from nine yards out to make it 24-3.

Two plays later, a Brady pass deflected off the hands of Hernandez and right to Aldon Smith, who returned it to the Patriots' 27-yard line. Crabtree then withstood simultaneous hits from a pair of New England defenders and fell over the goal line for a 27-yard TD and a 31-3 contest.

Game Notes

San Francisco has won eight of the 12 all-time meetings, and snapped a three- game losing skid to New England dating back to 1995 ... Brady moved into third place on the all-time list, having thrown a touchdown pass in his 46th straight regular-season game ... The Patriots moved above the 500-point mark in defeat, becoming the first team in NFL history to score as many in four different seasons ... Against the club which gave up the fewest points in the NFL, New England posted 32 first downs and 520 yards of total offense.