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.

More Images
Atlanta Braves' Dansby Swanson, right, celebrates with Ronald Acuna Jr. (13) and Freddie Freeman (5) after hitting a three-run home run off San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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.

Atlanta Braves pitcher Max Fried works against the San Francisco Giants during the first inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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

San Francisco Giants pitcher Jeff Samardzija works against the Atlanta Braves during the first inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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.

Atlanta Braves' Dansby Swanson swings for a three-run home run off San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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.

Atlanta Braves' Ozzie Albies, right, is congratulated by Dansby Swanson (7) after scoring on a wild pitch by San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

TRAINER'S ROOM

Atlanta Braves' Austin Riley, right, is congratulated by Brian McCann (16) after hitting a three-run home run off San Francisco Giants' Derek Holland during the seventh inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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

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½ games of first-place Philadelphia in the NL East.

Atlanta Braves' Dansby Swanson, right, celebrates with Ronald Acuna Jr. (13) and Freddie Freeman (5) after hitting a three-run home run off San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

Atlanta Braves' Dansby Swanson, right, celebrates with Ronald Acuna Jr. (13) and Freddie Freeman (5) after hitting a three-run home run off San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

Swanson sparked the offense with two hits, including his eighth home run — a three-run drive to center 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.

Atlanta Braves pitcher Max Fried works against the San Francisco Giants during the first inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

Atlanta Braves pitcher Max Fried works against the San Francisco Giants during the first inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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 defense with a pair of tough catches at the center field wall.

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

San Francisco Giants pitcher Jeff Samardzija works against the Atlanta Braves during the first inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

San Francisco Giants pitcher Jeff Samardzija works against the Atlanta Braves during the first inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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.

Atlanta Braves' Dansby Swanson swings for a three-run home run off San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

Atlanta Braves' Dansby Swanson swings for a three-run home run off San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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.

Atlanta Braves' Ozzie Albies, right, is congratulated by Dansby Swanson (7) after scoring on a wild pitch by San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

Atlanta Braves' Ozzie Albies, right, is congratulated by Dansby Swanson (7) after scoring on a wild pitch by San Francisco Giants' Jeff Samardzija during the second inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

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

Atlanta Braves' Austin Riley, right, is congratulated by Brian McCann (16) after hitting a three-run home run off San Francisco Giants' Derek Holland during the seventh inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)

Atlanta Braves' Austin Riley, right, is congratulated by Brian McCann (16) after hitting a three-run home run off San Francisco Giants' Derek Holland during the seventh inning of a baseball game Wednesday, May 22, 2019, in San Francisco. (AP PhotoBen Margot)