Matthew Stafford and the Rams pulled away in the fourth quarter to defeat the rival San Francisco 49ers 42-26 for their fourth consecutive victory.