Smith threw for a season-high 303 yards and three touchdowns, Frank Gore ran for 106 yards and a score, and the 49ers amassed a franchise-record 621 yards in blowing by the Bills 45-3 on Sunday.
Michael Crabtree and Vernon Davis each eclipsed 100 yards receiving to back Smith from the start. The 2005 No. 1 overall pick threw TD passes of 43, 28 and 10 yards and surpassed 300 yards passing for only the third time in his career.
Rian Lindell kicked a 31-yard field goal in the first quarter before San Francisco (4-1) scored the final 42 points to hand Buffalo (2-3) its second straight embarrassing loss.
San Francisco's previous best was 598 yards in a 34-31 loss to Buffalo on Sept. 13, 1992.
Ryan Fitzpatrick threw for 126 yards and an interception, and the Bills rushed for only 89 yards, most with the game well out of hand once again.
The Bills allowed 45 second-half points and 580 total yards in an embarrassing 52-28 home loss to New England last week. Beginning a two-week road trip, Buffalo's baggage also traveled to the West Coast.
Since taking a 21-7 lead against the Patriots last week, Buffalo has been outscored 90-10. The Patriots and 49ers combined to gain 1,178 yards. And with the 49ers shredding the New York Jets last week, they've outscored opponents 79-3 the past two weeks.
With the Bills unable to slow anybody down on defense, San Francisco abandoned its usually conservative game plan to deliver a scintillating show in the air.
Smith completed 18 of 24 passes and won for the first time when he threw for 300 yards. He also had a perfect 158.3 passer rating in the first half, when he threw for 237 yards -- a career best for a half.
The longest completion Smith had in the first four weeks was for 29 yards. In the first half alone, he completed a 53-yarder to Davis that set up a field goal by David Akers, a 43-yard touchdown to Kyle Williams and hooked up with Crabtree for 36 yards.
Williams took the back-shoulder pass from Smith, spun away from a defender and ran the final 10 yards free into the end zone. Williams fell to his knees, raised his arms and nodded to the sun-splashed crowd at Candlestick Park after giving the 49ers a 10-3 lead.
Every time the Bills blew an opportunity -- and they blew plenty -- the 49ers capitalized.
Backup quarterback Colin Kaepernick fumbled on an end-around and Buffalo took over at its own 17. Two plays later, Patrick Willis stripped Scott Chandler, San Francisco recovered and Smith floated a 28-yard touchdown to Crabtree to put the 49ers in front 17-3 with 24 seconds to go before the half.
A holding penalty on Jairus Byrd wiped out a punt return Leodis McKelvin took for a touchdown in the first quarter. The offense failed to score any points after McKelvin returned a kickoff 59 yards. And after a 12-play, 75-yard drive that took nearly 6 minutes stalled in the second quarter, Lindell kicked a 31-yard tying field goal for Buffalo's first score.
Smith led another touchdown drive that featured Kaepernick gaining 15 yards on a sweep and ended one play later when Gore dove over the pile for a TD that extended San Francisco's lead to 24-3.
Chris Culliver intercepted an underthrown pass by Fitzpatrick just shy of the goal line to end Buffalo's best chance to reach the end zone all afternoon.
Smith also tossed a 10-yard TD pass to Mario Manningham, Kaepernick ran 16 yards for a score and Anthony Dixon added a 3-yard run for the final touchdown.
Bills defensive end Mario Williams wore a small stabilizer on his left wrist instead of the brace he sported the first four weeks. He grabbed at his wrist after a short catch by Davis in the second quarter, never had a sack and was a complete non-factor against the 49ers offense.
Then again, so were most of his teammates.
Buffalo, which snapped an eight-game road losing streak with a Week 3 win at Cleveland, started a string of four of its next five on the road with another setback. The Bills will practice in Arizona next week to get ready for the Cardinals instead of traveling back East, similar to what the 49ers just did staying in Ohio between games at Minnesota and New York.
Antonio Gonzalez can be reached at: www.twitter.com/agonzalezAP