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 Buffalo Bills 45-3 on Sunday.
San Francisco also became the first team in NFL history with 300 yards passing and 300 yards rushing.
"Very cool," Smith said. "When you think of the 49ers, you think of great offense."
Michael Crabtree (seven catches for 113 yards) and Vernon Davis (seven catches for 106 yards) each eclipsed the century mark to pull San Francisco (4-1) into a tie with Arizona for the NFC West lead. Even Randy Moss, rarely targeted in his comeback, caught a pass for 11 yards.
Smith, the 2005 No. 1 overall pick out of Utah, threw TD passes of 43, 28 and 10 yards and surpassed 300 yards passing for only the third time in his career -- and first in a victory. The last time came when he had 309 yards in a loss at Philadelphia two years ago -- "a completely different world," he said -- in former coach Mike Singletary's final season.
"Quarterback was near perfect," Harbaugh said.
The Bills again found themselves on the wrong side of a 49ers record -- and quite a few others, too.
Rian Lindell kicked a 31-yard field goal in the first quarter before the 49ers 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 the Bills on Sept. 13, 1992, which also was Buffalo's worst.
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.
"They flat-out dominated the game from end to end," Fitzpatrick said. "We just got beat bad by a better team today. There was no fancy stuff. They are who they are and they just played better."
The Bills allowed 45 second-half points and 580 total yards in a humiliating 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, Buffalo has been outscored 90-10. The Patriots and 49ers combined to gain 1,201 yards. And with the 49ers shredding the New York Jets last week, they've outscored opponents 79-3 in their last two games.
The Bills became the first team to give up at least 550 yards in consecutive games in the same season since the 1950 New York Yanks.
"I have no answers and no excuses," beleaguered Bills coach Chan Gailey said. "I don't have the answers and I have to find the answers. That's my job."
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, who sprained his middle finger in the fourth quarter, completed 18 of 24 passes. 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.
Smith wore a light wrap on the finger during his postgame news conference. He said he thought the finger might be sprained, but he was not certain. He did not sound concerned.
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, who ran for 39 yards on four carries, 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.
"Everything about today was just amazing," Crabtree said.
A holding penalty on Buffalo's 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 field goal for Buffalo's only 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.
"I'm not a big statistical guy, don't get caught up in it," 49ers offensive coordinator Greg Roman said. "But at the same time, just in the normal course of events to be able to throw up that kind of production, obviously we're doing something right."
Buffalo allowed 500 yards in consecutive games for the first time in franchise history. ... Bills DE Mario Williams wore a small stabilizer on his left wrist instead of the brace he had the first four weeks. He appeared to grimace after a few plays. "It's good one day, and bad the next day," said Williams, who had two tackles and no sacks. ... Byrd injured a chest muscle, and Bills OL Chad Rinehart hurt his calf in the second half and did not return. Both are day to day.
Information from The Associated Press and ESPN.com's Mike Sando was used in this report.
Lions defensive tackle Nick Williams (shoulder) downgraded to out for Packers game
The Detroit Lions will be down another starter for Sunday's game at Green Bay after the team downgraded defensive tackle Nick Williams to out.
Which NFL road favorite should worry you in Week 2?
Preston Johnson explains why he's staying away from the Ravens in their road matchup vs. the Texans.
How Breonna Taylor's killing spurs Eagles' Jamon Brown to push for a 'new world'
Brown wants more than just answers in Taylor's case. He is effecting change too -- speaking at protests, talking to the mayor, and now he is meeting with the FBI.
Vegas sports royalty welcomes the Raiders with open arms
The Silver & Black and Sin City seem like an ideal match, as Vegas sports icons past and present are ecstatic about having the Raiders.
Week 2's biggest fantasy football questions: 32 NFL reporters give advice
Is Jonathan Taylor ready to shoulder the load for the Colts? Has Darius Slayton become the Giants' No. 1 wideout?
Bengals' big investment in defense has yet to pay off
After allowing 215 yards rushing to the Browns, the Bengals are once again looking for answers even after spending big on their defense.