PITTSBURGH (AP) Andrew McCutchen hit his 19th homer and Pedro Alvarez made up for some shaky defense by adding his 20th of the season as the Pittsburgh Pirates held off the San Francisco Giants 5-2 on Sunday night.
Francisco Liriano (9-6) gave up two unearned runs and struck out five in 5 1/3 eventful innings to win his fifth straight decision. The Pirates are 10-0 in Liriano's last 10 starts dating back to June 26.
Alvarez committed a pair of errors that led directly to both San Francisco runs but atoned with a solo shot in the seventh that gave Pittsburgh some breathing room. Mark Melancon worked a perfect ninth for his major league-leading 39th save.
More from FoxSports
Matt Duffy had three hits for the Giants. Ryan Vogelsong (9-9) failed to make it out of the fourth inning as San Francisco finished 2-5 on a seven-game road trip.
The Pirates remained within 3 1/2 games of St. Louis in the hotly contested NL Central after beating the Giants for the sixth time in seven tries. While Pittsburgh was hardly crisp - committing three errors and allowing the Giants to hang around by leaving 10 men on base - it still didn't matter.
Vogelsong spent six largely forgettable seasons with the Pirates from 2001-06 and PNC Park continues to give him trouble. He came in 6-13 with a 6.06 ERA at his old home, numbers that didn't improve during another rocky outing. Struggling with the command didn't help. The Pirates touched Vogelsong for three runs in the first thanks to a bases-loaded walk to Jung Ho Kang, an RBI-single by Neil Walker and a sacrifice fly by Pedro Alvarez.
It could have been worse, but Pittsburgh - which left no runners on base in a 3-2 walkoff win on Saturday - couldn't convert numerous chances to put the Giants away. The Pirates stranded at least one man in each of the first five innings, though Vogelsong left with one out in the third after needing 77 pitches to retire 10 batters.
Liriano worked in and out of trouble until the fifth when Alvarez's spotty defense helped San Francisco rally. Alvarez failed to communicate with second baseman Neil Walker on a pop up that eventually led to a run. The Giants pulled within 3-2 in the sixth shortly after a sharp grounder by Gregor Blanco skittered under Alvarez's glove for his 18th error of the season.
Still, Pittsburgh escaped. McCutchen tucked a Jeremy Affeldt curveball just over the fence in left to make it 4-2 in the bottom of the sixth. Pirates reliever Joakim Soria worked out of a two-on, two-out jam in the seventh and when Alvarez hit his fifth homer in the last two weeks to push the lead to 5-2, Pittsburgh was on its way to improving to 19-4 against the NL West while the Giants fell 1 1/2 games behind the Dodgers for the top spot in the division.
Giants: OF Angel Pagan isn't quite ready to return from a stay on the disabled list due to tendinitis in his right knee. Pagan is eligible to come off the DL on Tuesday but instead will play a couple of games for Triple-A Sacramento before the team makes a decision.
Pirates: Pittsburgh welcomed back SS Jordy Mercer on Sunday six weeks after Mercer went to the DL with a sprained left knee. The Pirates went 20-10 with Mercer out of the lineup thanks in large part to a late-summer surge by Kang. Mercer entered as a defensive replacement in the seventh when Kang shifted to third to replace Aramis Ramirez.
Giants: San Francisco is off Monday and begins a three-game series at AT&T Park against the Chicago Cubs on Tuesday. The Giants trail the Cubs by X games in the race for the second NL wild card spot. Matt Cain (2-3, 5.66 ERA) faces Chicago's Jake Arrieta (15-6, 2.30) in the opener. Cain is 0-2 with a 7.01 ERA in his last five starts.
Pirates: Pittsburgh heads to Miami for a four-game set against the Marlins on Monday. J.A. Happ will make his fourth start for the Pirates after arriving in a trade with Seattle last month. Happ threw six scoreless innings against Arizona last Wednesday and is 2-2 with a 4.54 ERA in six career starts against Miami.
Follow Will Graves at www.twitter.com/WillGravesAP