AP photo by Matt Slocum / Atlanta Braves second baseman Johan Camargo, left, leaps over the Philadelphia Phillies' J.T. Realmuto after forcing him out on a double play hit into by Jean Segura during the ninth inning of Sunday night's game in Philadelphia.

PHILADELPHIA — Austin Riley homered, doubled and drove in three runs in Atlanta's 10-run second inning, Dansby Swanson also went deep and the Braves held on for a wild 12-10 victory over the Philadelphia Phillies on Sunday night.

Nick Markakis and Marcell Ozuna each added three hits and two RBIs for the first-place Braves, who avoided a three-game sweep and moved three games ahead of the Phillies and the Miami Marlins in the National League East Division. Every player in Atlanta's starting lineup got at least one hit and scored at least one run.

Didi Gregorius, Rhys Hoskins, Andrew McCutchen and Roman Quinn homered for the Phillies, whose five-game winning streak was snapped. Hoskins went deep for the fourth time in six games.

"Our guys battled," Phillies manager Joe Girardi said. "We just came up a little short."

The teams combined for 28 hits in a game that took 4 hours, 13 minutes.

Every Braves batter scored at least once in the second, which started innocently enough when Markakis grounded out to pitcher Jake Arrieta (2-4). But Arrieta wouldn't get another out while facing the next seven batters, and he was lifted for David Hale after Marcell Ozuna's RBI infield single that made it 5-0.

Hale, making his first appearance with the Phillies since being acquired from the New York Yankees on Aug. 21, surrendered an RBI single to Travis d'Arnaud, a two-run double to Markakis and, finally, a two-run drive to deep left-center by Riley that put the Braves ahead 10-0.

Even with the big lead, Braves manager Brian Snitker didn't feel relaxed in the hitter-friendly stadium.

"You're never safe in this ballpark," he said. "You don't feel comfortable ever with any lead."

The Phillies got a run back in the bottom of the second on Gregorius' solo shot to right before scoring six runs in the third off starter Tommy Milone.

McCutchen's RBI double, Hoskins' two-run homer to left, Gregorius' two-run triple to right and Phil Gosselin's RBI groundout gave Philadelphia hope. The Phillies actually got the go-ahead run to the plate in the inning, but McCutchen, batting for the second time in the sequence, grounded out with runners on first and second.

"We never put our head down," Gregorius said. "It just shows you that our team never gives up."

The Braves got some more breathing room in the fifth on Ozuna's two-out RBI single to left that made it 11-8, but the Phillies closed within a run in the eighth on back-to-back one-out homers by Quinn and McCutchen off lefty Will Smith. The Atlanta reliever escaped more trouble by getting Hoskins and Harper to fly out.

Swanson cleared the wall in center in the ninth for a two-run cushion for Mark Melancon, who pitched a scoreless ninth for his sixth save in seven opportunities this year.

"That's a big add-on right there," Snitker said of Swanson's homer.

A.J. Minter (1-0) pitched 1 2/3 scoreless innings for the victory.

Arrieta lasted just 1 1/3 innings and gave up seven runs on six hits with three walks and no strikeouts.

"Just flat-out didn't throw the ball very well," he said.

Milone allowed seven runs in 2 1/3 innings in his first start with the Braves after being acquired earlier Sunday from the Orioles for two players to be named.

Atlanta hopes the 33-year-old lefty can provide some help to the rotation. Milone is the 11th starter the Braves have used this season, and most of them haven't had much success. Left-hander Max Fried is 5-0 with a 1.35 ERA, and the other 10 Braves starters are a combined 1-10 with a 7.23.

After signing a minor league deal with the Orioles in February, Milone received an MLB contract in July. He started on opening day as a replacement for the injured John Means and had 31 strikeouts and only four walks over 29 1/3 innings before Sunday.

Milone's best effort of the season — six innings of three-hit ball against the Washington Nationals on Aug. 7 — earned him his lone win with Baltimore.

The Braves lost ace Mike Soroka to a season-ending Achilles' injury and demoted two other expected starters, former All-Star Mike Foltynewicz and Sean Newcomb, to their alternate training site after poor showings. They never got a chance to use their projected No. 5 starter, former Cy Young Award winner Felix Hernadez, who opted out of the season because of coronavirus concerns.

Braves general manager Alex Anthopoulos will continue to pursue additional pitching help right up to Monday's trade deadline, though he conceded it may be tough to find another deal.

"There's not a lot of sellers out there. With the expanded playoffs, even the teams that are on the outside looking in are close," he said. "We didn't want to wait around. If a deal made sense to us, we wanted to go ahead and do it."

Atlanta's Freddie Freeman extended his hitting streak to 13 consecutive games with a two-run single in the second. Braves outfielder Ronald Acuna Jr. (right hamstring tightness), who scored on the hit, was lifted after Atlanta hit.

Girardi was ejected by second-base umpire Bill Welke in the ninth after arguing a foul ball call off the bat of Ender Inciarte.

"Tonight I didn't deserve to get tossed for what I said, and I'm pretty frustrated by it," Girardi said.

Atlanta outfielder Adam Duvall (sore left Achilles') returned to the lineup after missing Saturday's game.