The 49ers recorded their seventh consecutive regular-season victory over the Rams, winning 24-9 on Monday Night Football.

Both teams are 2-2, as are the Cardinals and the Seahawks in the NFC West.

San Francisco had 327 yards to 257 for the Rams. The 49ers sacked Matthew Stafford seven times, dominating the Rams’ makeshift offensive line hard hit by injuries, and forced him into two turnovers.

Stafford now has taken 16 sacks this season.

He was 30-of-46 for 241 yards and threw an interception that Talanoa Hufanga returned 52 yards for a touchdown. The pick-six gave the 49ers a 24-9 lead with 6:27 left.

It was the 28th pick-six of Stafford’s career, including the four he threw last season in his first season with the Rams.

Stafford’s lost fumble with 1:49 remaining ended the Rams’ final comeback hope.

The Rams went 0-for-3 in the red zone, had a long play of 18 yards and couldn’t find a consistent receiving threat outside of Cooper Kupp and Tyler Higbee. Kupp had a career-high 14 catches but for only 122 yards, and Higbee had 10 receptions for 73 yards.

Samson Ebukam and Nick Bosa each had two sacks for the 49ers, and Ebukam forced the fumble that Stafford lost.

Deebo Samuel starred on offense, with six catches for 115 yards and a touchdown. His score covered 57 yards and was one of the top plays in the league this season.

Jeff Wilson had 18 carries for 74 yards, including a 32-yard touchdown run.

Jimmy Garoppolo went 16-of-27 for 239 yards and the touchdown pass to Samuel.