49ers All-Pro linebacker Patrick Willis has left Sunday's game against the St. Louis Rams with a right hamstring injury. His return was doubtful.