Frank Gore ran for 5- and 1-yard touchdowns for the 49ers (3-7).
The Rams' Marc Bulger completed 34-of-53 tosses for 295 yards and a touchdown, but was intercepted twice.
Antonio Pittman rushed 14 times for 95 yards for St. Louis (2-8), which has lost four in a row.
The Rams' Dave Looker caught a touchdown pass and Josh Brown made three field goals.
Aaron Carter is still in love with Hilary Duff
Ray Liotta sues skin care company over use of likeness