Updated

Wilin Rosario and the Colorado Rockies had a chance to chase Tim Lincecum in the first inning.

Rosario flied out with the bases loaded and Lincecum settled in from there, pitching the San Francisco Giants to an 8-3 victory Sunday that completed a three-game sweep.

"We had Timmy on the ropes," Rockies manager Jim Tracy said. "We were one swing away from him being out of the game in the first inning, which leads to what took place over the course of the game. The big hit that would've changed their entire day from a pitching standpoint and could've changed our entire day, we weren't able to get that."

Lincecum (6-11) worked around five walks, allowing one run and five hits in six innings. After going 4-9 with a 5.26 ERA in 18 starts from the start of May through July 25, he is 2-0 with a 1.38 ERA in his last two outings against the Mets and Rockies.

"I think it's just the competitiveness," Lincecum said. "I don't think anything is different. I'm not throwing any harder, obviously. I'm not throwing any different kind of pitches. I think it's just the conviction on the pitches. Every pitch before you throw it is with a purpose."

The two-time NL Cy Young Award winner had not won consecutive starts since April 23 against the Mets and April 28 against the Padres. In Lincecum's previous appearance at Coors Field, he gave up six runs in 2 1-3 innings on April 11.

"This is one of his guttiest efforts," Giants manager Bruce Bochy said. "That first inning, he wasn't too far from coming out. For him to regroup and give us six solid innings, that was pretty impressive."

Lincecum faced seven batters in the first and threw 36 pitches. He issued two walks and gave up two hits, including Jordan Pacheco's RBI single.

But the Rockies failed to deliver the knockout blow, another demoralizing moment on a 1-8 homestand that included a pair of sweeps.

"If you want to get better, you can't just put your head down," Colorado slugger Carlos Gonzalez said. "It's a tough situation that we're in right now. We have a lot of young guys on our team and they are in a tough spot right now. I remember being young and you always think that you might get sent down. If you have that in the back of your mind, it bothers you, it doesn't let you concentrate on what you're doing. When they figure it out, they're going to have better results on the field."

Tyler Chatwood (1-2), recalled from Double-A Tulsa before the game to take the rotation spot of injured Christian Friedrich, allowed three runs — one earned — on two hits and four walks in 3 1-3 innings.

"When he was in the strike zone, he was effective," Tracy said. "His ball was live, he threw some good breaking balls. He wasn't in there consistently enough. He had very sporadic command. He used up a lot of pitches in a very short period of time."

Hunter Pence, acquired Tuesday from Philadelphia, had a run-scoring groundout in the first for the Giants. He hit an RBI double in the fifth for a 4-1 lead and had another run-scoring double in a three-run seventh that made it 7-1. He entered hitting .118 (2 for 17) with two RBIs in his four previous games with San Francisco.

Marco Scutaro capped the Giants' seventh with a two-run double. Melky Cabrera tripled leading off the ninth and scored on a single by Buster Posey, who got a day off from catching but started at first base.

Colorado pulled to 7-2 in the seventh on Gonzalez's RBI single. With the bases loaded and one out, Sergio Romo relieved Javier Lopez and struck out Matt McBride and Rosario to end the threat.

San Francisco scored its first three runs without a base hit. Angel Pagan drew a leadoff walk in the first and scored from third base on a Rosario's passed ball. Ryan Theriot reached on Pacheco's error at third base and scored on Pence's groundout.

NOTES: The Rockies placed LHP Jonathan Sanchez on the 15-day DL with biceps tendinitis. ... Cabrera started an inning-ending double play in the fourth when he caught Dexter Fowler's fly ball in left and threw out Rosario at the plate, with help from a block by catcher Hector Sanchez.