SAN FRANCISCO — Dansby Swanson and Freddie Freeman hit back-to-back homers in the second inning, when Atlanta scored six unearned runs after San Francisco botched a double play, and the surging Braves beat the Giants 9-2 on Wednesday night.

Austin Riley also homered for the Braves. Max Fried allowed two runs in six innings for his third straight win and NL-leading seventh overall. Fried (7-2) also collected his first career RBI with a bases-loaded fielder's choice as part of Atlanta's big inning.

One day after closer Luke Jackson blew a two-run lead in the ninth inning of a 4-3 loss, the Braves jumped out to an early lead and coasted to their ninth victory in 12 games to pull within 1 1/2 games of first-place Philadelphia in the NL East.

Swanson sparked the offence with two hits, including his eighth home run — a three-run drive to centre field. Freeman, who singled in the first, followed with his team-leading 12th. Freeman has gone deep in five of the last seven games.

The two home runs came after Giants starter Jeff Samardzija (2-3) extended the inning with a pair of tosses that went awry. Samardzija made a throwing error after fielding Ozzie Albies' sharp comebacker with one out. San Francisco was in a defensive shift, but third baseman Evan Longoria appeared to stop short of the bag at second when Samardzija made the throw.

Three batters later, Ronald Acuña Jr. struck out but reached on a wild pitch by Samardzija. Swanson and Freeman followed with the second set of back-to-back home runs for the Braves this season.

Fried had only two clean innings and walked two with five strikeouts. Newly acquired reliever Anthony Swarzak retired three batters. Dan Winkler and Josh Tomlin pitched one inning apiece.

Acuña helped out on defence with a pair of tough catches at the centre field wall.

Riley hit a three-run homer off Derek Holland in the seventh.

Buster Posey had an RBI single for San Francisco but was thrown out trying to reach second. Atlanta right fielder Nick Markakis made a barehand grab after the ball caromed off the brick wall and made a strong throw to Swanson, who tagged Posey as he was sliding in.

Tyler Austin homered for the Giants.

Samardzija had seven strikeouts and gave up four hits and two walks in six innings.

TRAINER'S ROOM

Braves: 3B Josh Donaldson had the night off.

Giants: 1B Brandon Belt was rested before pinch hitting in the ninth. ... 2B Joe Panik got the night off.

UP NEXT

Madison Bumgarner (3-4, 4.21 ERA) pitches Thursday for the Giants and has won seven consecutive decisions against the Braves. The big lefty last lost to Atlanta in 2012. RHP Kevin Gausman (2-3, 4.31) takes the mound for the Braves. Gausman has one win in his past eight starts.

___

More AP MLB: https://apnews.com/tag/MLB and https://twitter.com/AP_Sports