With the victory over their divisional rivals, the Rams (7-8) now only need to beat Seattle in the two teams' season finale next week to take their first division crown since 2004.
The 49ers (5-10), meanwhile, saw their slim playoff hopes evaporate with the setback.
Troy Smith threw for 153 yards and was intercepted once. He hooked up with Michael Crabtree on a 60-yard touchdown pass but was benched early in the fourth quarter.
Puzzle-maker slips 'Murdoch Is Evil' into Rupert Murdoch's Sunday Telegraph
N.J. man wakes up from 10-hour sleep with knife in back