Updated

Angel Pagan registered four hits and finished a home run shy of the cycle, as the San Francisco Giants beat the Atlanta Braves, 5-3, in the second test of a four-game set Friday at AT&T Park.

Pagan scored twice and also knocked in a run, while Marco Scutaro, Pablo Sandoval and Buster Posey added an RBI apiece for the Giants, who won their fifth straight contest.

Ryan Vogelsong (11-7) allowed three runs on four hits and a walk with five strikeouts over 6 1/3 frames to snap a two-game slid.

"He's definitely been our spark plug," Vogelsong said of Pagan. "It's been fun to watch."

Javier Lopez recorded the final out of the eighth and then fired a perfect ninth to nail down his fourth save of the season.

Ben Sheets (4-4) gave up four runs on nine hits and three walks over 4 1/3 innings to absorb the loss.

"I hate the way I pitched," Sheets lamented. "I feel like I made some good pitches, just didn't put anybody away."

Freddie Freeman hit two homers and Jason Heyward also went deep, but the Braves lost for the sixth time in their last seven games.

Heyward clubbed a two-out homer in the first to give Atlanta an early lead and Freeman pressed the advantage to 2-0 in the second when he crushed a leadoff blast to center field.

The Giants, who wasted a bases-loaded chance in the second when Vogelsong grounded into a double play, countered in the third as Pagan doubled to start the frame, moved to third on a bunt and scored easily on Sandoval's two-bagger to left field.

Posey's fly out pushed Sandoval to third and, after Hunter Pence walked, Sheets uncorked a wild pitch, allowing Sandoval to score and tie the game.

San Francisco plated two more in the fourth to grab the lead for good. Gregor Blanco singled to start the inning and moved to second two batters later on Vogelsong's bunt.

Pagan then scorched a triple into right field to plate Blanco and Scutaro followed with a single to score Pagan for a 4-2 lead.

The Giants couldn't capitalize again with the bases full in the fifth, but tacked on a run in the sixth. Pagan smacked a leadoff single, but was wiped away on Scutaro's fielder's choice.

Scutaro moved to second on Sandoval's fly out to center field before scoring on Posey's line-drive double that tipped off Chipper Jones' glove at third and rolled into left field to extend the lead to 5-2.

Freeman then launched his second homer of the night into right field in the seventh, chasing Vogelsong from the contest.

Jose Mijares entered and served up a single to Brian McCann before Santiago Casilla took over on the mound and retired the next two Braves to maintain the Giants' two-run advantage.

Sergio Romo and Lopez combined to blank the Braves in the eighth before Lopez retired the side in order in the ninth.

Game Notes

It was the third multi-homer game of Freeman's career and his second this season ... Pagan also had a four-hit game on Aug. 3 against the Colorado Rockies ... Posey had missed the last two games with a tight right hamstring ... The Giants went 5-for-13 with runners in scoring position and left 12 on base.