ATLANTA — Already a three-time All-Star and four-time Gold Glove Award winner, Brandon Phillips learned this summer as a 37-year-old minor leaguer to relish playing baseball “until I wake up.”

Added Phillips: “I’m still dreaming.”

Phillips’ two-out, two-run homer in the ninth inning off A.J. Minter highlighted his long-awaited season debut on Wednesday and capped the biggest comeback by the Boston Red Sox this year for a 9-8 win over the Atlanta Braves.

“Honestly that was the most fun I’ve had all season, just watching the last few innings,” Red Sox Manager Alex Cora said.

Phillips took a big swing and then rocked back as he watched the ball head toward the left-field seats.

“My favorite part was the lean-back that he had,” teammate Brock Holt said.

Said Minter: “I missed by an inch with the pitch and he made me pay.”

After the game Phillips stood at his locker, attempting to untangle chains left knotted when Red Sox players dumped a cooler filled with a sports drink over his head. He kept grinning even when he gave up on solving the knot.

“For us to come back like we did, that was amazing,” Phillips said.

The Red Sox overcame a late six-run deficit and seesawed past Atlanta to sweep the three-game series between division leaders.

Boston, with the best record in the majors, scored six times in the eighth to make it 7-all. After Freddie Freeman hit a solo homer with two outs in the eighth, the Red Sox bounced back for their 97th win this year.

Phillips sat out the first half of this year, signed a minor league contract with Boston in late June and was called up from Triple-A Pawtucket on Tuesday. He didn’t play that night, but started at second base in the final game of the interleague set.

“When I was in the minor leagues with the guys, they really showed me why I still play this game,” he said. “… Just keep on having fun. You never know what might happen. Your career could be over.”

After becoming the first player in Red Sox history to wear No. 0, in one swing the guy with the zero became a hero. Andrew Benintendi singled with one out off Minter (4-3) and Steve Pearce struck out, bringing up Phillips, who homered on the first pitch.

Braves left fielder Ronald Acuna Jr., who hit another leadoff homer in the first, didn’t move as Phillips’ shot sailed over his head. Phillips scored three runs, drew two walks and made the most of his first hit with Boston.

Braves stadium organist Matthew Kaminski played “Welcome Back” before Phillips’ first at-bat in the second inning. Phillips, a high school star in the Atlanta area who played most of last season with the Braves, tipped his helmet and then walked.

“To be in Atlanta in front of my family and friends, that was pretty awesome,” he said.

In a game packed with momentum shifts, Freeman hit his tie-breaking homer off Brandon Workman (4-0). Freeman was given his first break from the starting lineup this season before coming off the bench in a defensive switch.

Atlanta led 7-1 before Boston scored six times in the eighth to tie the game. Atlanta reliever Dan Winkler gave up four hits and four runs without retiring a batter. Christian Vazquez got two hits in the inning, Blake Swihart hit a two-run double and pinch-hitter Ian Kinsler tied the game with a two-run single. The Red Sox sent 12 batters to the plate in the inning, using five pinch hitters and batting about 40 minutes against four relievers. Craig Kimbrel pitched the ninth for his 38th save.

Ozzie Albies hit a two-run triple in Atlanta’s five-run fifth inning that made it 7-1.

With the sweep, Boston has won 25 of its last 29 games against National League teams.

NOTES: Portland native Ryan Flaherty rejoined the Braves when rosters expanded over the weekend after getting designated for assignment on Aug. 20. He made his first appearance since returning on Wednesday, entering the game as a pinch runner in the fifth inning and scoring a run. He also played in the field at first base and third base … Braves SS Dansby Swanson didn’t start and struck out as a pinch hitter after he was hit on his helmet by an 85-mph slider from Rick Porcello in the second inning on Tuesday night. Swanson had ringing in his ears but passed the concussion tests. … Acuna homered off Hector Velazquez’s second pitch, giving the rookie a franchise single-season record eight leadoff homers. Acuna was tied with Marquis Grissom, who hit seven leadoff homers in 1996. Overall, Acuna has 24 homers, including 17 since the All-Star break. … The collapse by the Braves’ bullpen wasted a strong start by right-hander Mike Foltynewicz, who gave up only two hits and one run in six innings.