SAN FRANCISCO -- Matt Cain finally started getting his pitches down after a shaky start. Good thing, too, because Giants manager Bruce Bochy was on the verge of pulling his ace in the second inning.
That patience paid off for the defending World Series champions and for Cain.
"That shows you how tough he is, the makeup of Matt Cain, and how strong he is," Bochy said after the Giants rallied past the Colorado Rockies 7-3 Sunday. "That's intestinal fortitude in his part. He found a way. That's as gutty an effort as you can see."
Cain (4-2) matched his season high of five walks but allowed only two runs and two hits in five innings. He is 4-0 with a 3.49 ERA in his last five outings after beginning the season 0-2 with a 6.49 ERA in his first six starts.
"I thought I might run out of pitches sometime in the third," Cain said. "I just made a little bit better pitches where the balls weren't maybe up as much."
He walked five of his first 10 batters but retired 11 of his last 12 and improved to 17-7 against the Rockies.
"If you don't get him and give him a chance to stay in the game, he's going to make the most of it and that's what he did," Colorado's Troy Tulowitzki said. "Once he smells he has a chance to get a win, he turns it up a notch."
Brandon Belt hit a tiebreaking two-run double in the fifth, and six pitchers combined for one-run relief, keeping San Francisco tied with Arizona for the NL West lead.
In his first appearance at AT&T Park, Jon Garland (3-6) allowed five runs -- two earned -- seven hits and four walks in five innings. While the Rockies swept a three-game series from the Giants in Denver two weeks ago, Colorado is 1-5 this year in San Francisco, where the Rockies have lost 12 of their last 15.
Carlos Gonzalez struck out three times with runners in scoring position after homering in his previous three games. Tulowitzki went hitless after drawing a walk in his first plate appearance while Dexter Fowler reached base four times but scored just once.
"We had some opportunities early," Rockies manager Walt Weiss said.
Michael Cuddyer hit a two-run double in the first for Colorado. Posey's seventh homer trimmed the deficit to 2-1 in the second, and Brandon Crawford tied it when he hit into a run-scoring forceout in the fourth.
Belt walked in his first two plate appearances before doubling off Garland to break a 2-all tie. The drive followed a two-out fielding error by second baseman DJ LeMahieu on Hunter Pence's high popup to short right field.
Torres' RBI double drove in Belt for a 5-2 lead. Pence added a two-run double in the eighth against Edgmer Escalona.
Cuddyer, activated from the DL on Friday after recovering from a back injury, was removed from the game in the bottom of the sixth with a bruised right forearm after getting hit by a pitch leading off the top half. X-rays were negative. ... San Francisco reliever Santiago Casilla will undergo surgery this week to remove a cyst from inside a bone in his right leg. Casilla has been pitching with the cyst since last season. "That will hopefully correct what's going on over there," Bochy said. The timetable for recovery won't be known until after the operation. ... OF Angel Pagan was held out of the Giants lineup because of a sore left hamstring, one day after hitting a game-ending inside-the-park home run. Bochy said Pagan aggravated his hamstring earlier in the game before his walkoff hit. ... San Francisco LHP Madison Bumgarner (4-2) is slated to pitch Monday's series opener at Oakland. ... Colorado RHP Jhoulys Chacin (3-3), who starts against Houston on Monday, hasn't won since April 19.