SAN FRANCISCO (AP) Carlos Gonzalez spent time in the batting cage the past few days. No wonder he had so much fun returning to the lineup.
Gonzalez matched his career high with five hits, Nolan Arenado hit a pair of home runs and had four RBIs, and the Colorado Rockies held on to beat the San Francisco Giants 8-6 on Friday night.
''It was one of those nights whenever I made contact, it was actually a hit,'' Gonzalez said. ''I had a couple that weren't hit hard enough, but they found holes. It was fun to hit tonight.''
Ben Paulsen had three hits and added a two-run single for the Rockies, who won their fifth in six games after losing eight of nine.
Tim Hudson (5-7) took a shutout into the sixth inning, but Arenado's 21st home run ended it.
''It was a weird night,'' Hudson said. ''I felt like we were one pitch away from shutting them out and then they popped us for three runs there.''
Arenado has already set a single-season career high with 64 RBIs.
''I'm just trying to hit the ball hard,'' Arenado said. ''Lately, they have been going out for some reason. I don't have an answer for that.''
Chad Bettis (4-2) won his second start despite giving up his fourth home run in his past 17 1/3 innings. He did not give up a homer in his first 38 1/3 innings. Bettis allowed three runs and six hits over six innings, and walked two and struck out three.
Andrew Susac homered and Brandon Belt and Brandon Crawford each drove in a run for the Giants, who have lost three of their last five.
The Giants scored three times in the ninth against Tommy Kahnle to make things interesting. Three walks, a passed ball and RBI singles by Gregor Blanco and Joe Panik cut the deficit to two runs before Kahnle struck out Matt Duffy and Buster Posey, both on full counts.
''All you can ask is to bring the winning run to the plate,'' Giants manager Bruce Bochy said. ''We had the right guys up, too. It just didn't happen.''
Gonzalez, who was resting a sore hand, doubled in a run in the seventh against Javier Lopez, who replaced Hudson and Paulsen singled home two runs. Gonzalez, a home run shy of the cycle, recorded his 20th career game of at least four hits.
''It ended the way we wanted it to end,'' Rockies manager Walt Weiss said. ''It wasn't exactly how we drew it up. We would have liked to coast to the end, but I'm not surprised they made a run.''
Arenado (13), Troy Tulowitzki (10) and Charlie Blackmon (10) each extended hitting streaks, the three longest active in the NL. Tulowitzki has hit safely in 22 of 23 games and has reached base in each of his last 25 games.
Rockies: Left-hander Jorge De La Rosa, who left Thursday night's game with a cut on his left middle finger, said he should make his next start. ''His finger looks a lot better than it did 24 hours ago,'' Weiss said. ''The next few days will tell.'' ... Gonzalez (mild hand sprain) made his first start since Sunday.
Giants: Outfielder Angel Pagan bruised his left knee running into the outfield wall. He was not available for the game and was scheduled for an MRI. ... Left-hander Jeremy Affeldt went on the disabled list with a left shoulder sprain. ... Right-hander Matt Cain threw his final rehab start and will likely take his spot in the rotation next week.
Rockies: Left-hander Chris Rusin (3-2, 5.03) threw seven shutout innings last year in his only career start against the Giants. He's 4-7 with a 5.10 ERA in 19 games on the road.
Giants: Right-hander Tim Lincecum (7-4, 3.86) is coming off the shortest outing of his career, 1 1/3 innings against the Los Angeles Dodgers last Sunday. He's 11-10 with a 3.96 ERA in 29 starts against the Rockies.