SAN FRANCISCO -- San Francisco quarterback Alex Smith threw for 303 yards and three touchdowns, and the 49ers rolled up a franchise-record 621 net yards Sunday, routing the Buffalo Bills 45-3 at Candlestick Park.
The 49ers broke their old mark of 598, set on Sept. 13, 1992, in a 34-31 loss to the Bills.
Smith posted a career-high 156.2 passer rating and fell just 7 yards shy of his career high.
The 49ers (4-1) pulled into a tie with Arizona for first place in the NFC West. Buffalo, which was coming off a 52-28 loss to New England, fell to 2-3 with another disheartening defeat.
San Francisco wide receiver Michael Crabtree caught six passes for 113 yards and a touchdown, while 49ers tight end Vernon Davis caught five passes for 106 yards. Frank Gore rushed for 106 yards on 14 carries to lead the San Francisco ground attack.
The 49ers had two 100-yard receivers in a game for the first time since Dec. 10, 2010, against Philadelphia when Crabtree (105) and Davis (104) accomplished the feat.
One week after shutting out the Jets, the 49ers' defense held Buffalo to a field goal and just 204 net yards.
Bills quarterback Ryan Fitzpatrick completed 16 of 26 passes for 126 yards with an interception and a passer rating of 57.5. The Bills entered the game ranked No. 4 in the league in rushing but ran for just 89 yards.
Smith came out throwing in the first half, completing 12 of 15 passes for 237 yards -- a career high for a half -- and two touchdowns as the 49ers built a 17-3 lead. He also had a perfect passer rating of 158.3, another career high for a half.
Crabtree caught five passes for 103 yards and a 28-yard touchdown in the first half, while Davis grabbed four for 82 yards. Wide receiver Kyle Williams caught a 43-yard touchdown pass, his first score of the season.
The 49ers took the opening kickoff and marched 79 yards to the Bills' 1 before stalling and settling for David Akers' 19-yard field goal.
Buffalo pulled even at 3-3 on Rian Lindell's 31-yard field goal with 10:46 left in the first half.
The 49ers need just two plays to reach the end zone and take a 10-3 lead. Smith hit a wide-open Crabtree over the middle for 36 yards to the Bills' 43. On the next play, Williams lined up wide right and beat cornerback Aaron Williams in man-to-man coverage on deep route down the sideline. He caught Smith's pass inside the 10, spun free and raced into the end zone.
It looked as if the Bills would be down by just seven points at halftime after forcing a 49ers turnover deep in Buffalo territory. San Francisco backup quarterback Colin Kaepernick lined up deep in the backfield, took a pitch from Smith and headed around left end for 6 yards, but safety George Wilson forced a fumble, and Buffalo defensive tackle Kyle Williams recovered at the Bills' 17 with 49 seconds left.
Instead of running out the clock, the Bills attacked. On third-and-6, Fitzpatrick hit tight end Scott Chandler for 11 yards, but 49ers linebacker Patrick Willis forced a fumble, and safety Dashon Goldson recovered.
On first down, Crabtree ran past rookie corner Stephon Gilmore on what appeared to be a broken coverage, and the receiver was wide open in the left corner of the end zone, where Smith hit him with a 28-yard strike. That put the 49ers up 17-3 with 24 seconds left in the half.
Gore's 1-yard touchdown run made it 24-3 with 9:06 left in the third quarter. Smith's 10-yard touchdown pass to Mario Manningham put the 49ers ahead 31-3 with 14:12 left to play.
Kaepernick's 16-yard touchdown run on a read-option increased San Francisco's lead to 38-3 with 9:55 remaining, and Anthony Dixon added a 3-yard touchdown run with 1:11 left.
NOTES: San Francisco running back Brandon Jacobs (knee) practiced this week but was inactive for the game. He could be in line to make his 49ers debut next week against the New York Giants, his former team. ... Bills starting left tackle Cordy Glenn (ankle) and right guard Kraig Urbik (ankle) were inactive. Chris Hairston started for Glenn, and Colin Brown subbed for Urbik. ... Akers extended his streak to 21 games with a field goal, tying Bruce Gossett's team record. ... Buffalo's Leodis McKelvin had an 80-yard punt return for a touchdown in the first quarter nullified by a holding penalty on Jairus Byrd. ... Byrd left the game in the second half with a chest injury, and Bills guard Chad Rinehart suffered a calf injury.