Updated

Tim Lincecum tries to lead the San Francisco Giants to a series sweep on Wednesday they wrap up their three-game set against the Arizona Diamondbacks at Chase Field.

Lincecum has seemed to bounce back from his awful showing in 2012 and is 2-1 to start this year with a 3.64 ERA. He suffered his first loss of the season his last time out on Friday in San Diego, as he allowed two runs and six hits in seven innings. He also struck out nine batters and has fanned 17 in his last two starts.

"On a personal note, it was great to go seven and not be all over the place," said Lincecum, who lost 15 games a year ago and pitched to a 5.18 ERA. "I'll take it as a positive that I put the team in position to come back. I'm trying to get away from comparing this year to last year."

Lincecum has faced the D'Backs 21 times and is 7-8 with a 3.44 ERA.

San Francisco moved to the brink of a sweep on Tuesday, as Pablo Sandoval hit a go-ahead two-run homer in the ninth to help the Giants to a 2-1 win.

Angel Pagan singled to lead off the inning and stole second base. With J.J. Putz (2-1) pitching with one out, Sandoval knocked the ball deep over the right field wall to put the Giants on top. Putz absorbed the loss and was dealt his fourth blown save of the season.

"Felt pretty good when it came off my bat," said Sandoval. "I'm happy to support my teammates, to win the game."

Madison Bumgarner pitched seven shutout innings, allowing just three hits and a walk, but earned a no-decision. Sandy Rosario (1-0) got the final out in the eighth, earning his first major league win. Sergio Romo pitched a flawless ninth to notch his 10th save of the season.

Josh Wilson hit a solo homer in the eighth while starter Trevor Cahill allowed one run on four hits and a walk over eight-plus innings.

"It was real heartbreaking," said Wilson. "Any loss is upsetting, disappointing. When you lose in the ninth, it certainly stings a little bit."

Arizona will turn to righty Brandon McCarthy in Wednesday's finale. McCarthy fell to 0-3 on Friday against the Colorado Rockies, as he was pounded for six runs and nine hits in six innings to raise his ERA to 7.48.

"He is throwing well, he had the best stuff he has had since joining us," Arizona manager Kirk Gibson said after McCarthy's outing on Friday. "But if you look at the difference a few plays make, it's huge. But it's part of baseball and he has to deal with it. ... In my mind, he understands what's going on."

This will be his first-ever appearance against the Giants.

Arizona took two of three from the Giants earlier in the season.