Cary Edmondson-USA TODAY Sports

Christian McCaffrey gained 177 yards from scrimmage and scored four touchdowns as the San Francisco 49ers remained undefeated with a 35-16 victory over the Arizona Cardinals on Sunday in Santa Clara, Calif.

It was the 14th consecutive regular-season win for the 49ers (4-0) dating back to last season, and the seventh straight game in which they have scored at least 30 points.

McCaffrey rushed for 106 yards on 20 carries and scored three touchdowns, while adding another score on one of his seven receptions for 71 yards.

Brock Purdy scored the final touchdown of the game on a 1-yard run and completed 20 of 21 passes for 283 yards and a 134.6 passer rating. Brandon Aiyuk had six catches for 148 yards for the 49ers.

Josh Dobbs completed 28 of 41 passes for 265 yards and two touchdowns for the Cardinals (1-3).

McCaffrey scored on runs from 1 and 18 yards out to help San Francisco establish a 14-0 lead with 14:14 left in the first half.

The Cardinals' first scoring drive was set up by an 8-yard run by Dobbs on fourth-and-7 from the 49ers' 45-yard line. That led to a 38-yard field goal by Matt Prater with 8:14 remaining in the second quarter.

McCaffrey's third touchdown, a 6-yard reception over the middle, gave the 49ers a 21-3 lead with 5:22 to play in the half. The Cardinals answered with a drive that continued after a 2-yard run on a fake punt by upback Ezekiel Turner from their own 21-yard line.

After moving to the San Francisco 49-yard line, Dobbs connected with rookie wide receiver Michael Wilson for 33 yards and a 16-yard score on back-to-back plays, making it 21-10 with 23 seconds left. It was the first touchdown of Wilson's career.

Wilson scored again with 4:12 in the third quarter on an 8-yard pass from Dobbs, cutting the Cardinals' deficit to 21-16.

After McCaffrey's fourth touchdown that gave the 49ers a 28-16 lead, Arizona drove to the 49ers 35-yard line, but Dobbs was sacked by defensive tackle Javon Hargrave for an 8-yard loss on third-and-10 with 9:22 remaining, ending the threat. San Francisco sealed the game with a 14-play, 77-yard touchdown drive that took 7:14 off the clock.

More must-reads:

TODAY'S BEST
Former MLB infielder Sean Burroughs dies at 43 years old
Angels superstar explains why he chose not to play through knee injury
Cardinals catcher's injury timeline revealed
Suns hire ex-NBA champion as new head coach
Frank Vogel fell victim to a Suns ownership group eager to win
Luka Doncic hands OKC first playoff loss with gutsy Game 2 effort
Three takeaways as Rangers take commanding 3-0 series lead on Hurricanes
Rams make surprising move with former team captain
Ohio State AD is wrong for thinking Michigan wins deserve asterisk
Padres OF Jurickson Profar is a legitimate MVP candidate
Steelers' Cameron Heyward comments on controversial Justin Fields idea
Pacers coach claims officials are biased against 'small market' teams
14-year-old phenom signs unprecedented MLS deal that includes future Man City transfer
Tiger Woods, Rory McIlroy's 'soured' relationship paints murky future for PGA Tour
Stars almost blow another lead, even series with Avalanche
Auburn's Hugh Freeze uncomfortable with 'bidding wars' for top players in transfer portal
Cavaliers punch back, blow out Celtics in Game 2
Coach: Oilers star center could miss Game 2 vs. Canucks
Watch: Cavaliers' Evan Mobley turns defense into offense in Game 2 vs. Celtics
Xander Schauffele tops stacked leaderboard after first round of Wells Fargo Championship