DENVER — San Francisco right-hander Matt Cain left in the second inning Friday night against Colorado with a strained right hamstring.

Cain appeared to be in some discomfort after throwing his 26th pitch of the game. He went 1 2-3 innings and allowed one hit.

Righty Albert Suarez took his place on the mound. Suarez took a grounder off the left leg in the third inning, but remained in the game.

Cain struggled early in the season, but has turned things around. He was 1-1 with a 1.71 ERA over his last three starts.

Before the game, manager Bruce Bochy credited Cain's resurgence to better rhythm and more confidence.