Adam Duvall lost a home run to a baserunning miscue, but Atlanta rebounded with homers by Austin Riley, Ozzie Albies and Freddie Freeman and the Braves beat the Arizona Diamondbacks 9-2 on Wednesday night.

Ian Anderson pitched two-hit ball in six-plus innings as Atlanta (80-70) won its fifth straight and maintained its three-game lead over Philadelphia in the NL East with 12 games remaining.

The Braves got to Merrill Kelly for three runs in the first — and that could have been four, except Duvall passed Riley between first and second after his deep drive to left-center tipped the glove of Arizona center fielder Jake McCarthy and went over the wall.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Kelly (7-11) walked leadoff man Jorge Soler, and Freeman followed with a double. Albies hit a sacrifice fly to left and Riley beat out an infield hit with Freeman advancing to third.

Duvall then hit what appeared to be his 38th homer of the season. But Riley, thinking McCarthy had the ball in his glove, retreated to first base as Duvall passed him between first and second. Duvall was ruled out at second on what’s known as a "runner’s fielder’s choice." Freeman and Riley scored on the play to give Duvall 109 RBIs this season, which leads the National League.

"I wasn’t sure he didn’t catch it," Braves manager Brian Snitker said. "You may be making the right play, but if the guy in front of you doesn’t, you’ve got to be aware of it. It’s not a bad rule at all."

Albies became the third player to reach 30 home runs for the Braves this season, joining Riley (31) and Freeman (31). Duvall has 15 with the Braves since being acquired from Miami in July. He also became the first second baseman age 24 or younger to hit 30 home runs and record 100 RBIs in a season.

"It’s very special," Albies said.

Snitker credited Albies' preparation.

"Ozzie’s that boring pro," Snitker said. "Comes to work, his attitude is off the charts. He brings the energy every day. He never has a bad day."

Duvall also singled off the wall in left in the eighth, but was thrown out trying to stretch it into a double. The call was appealed, but upheld on replay review.

Riley homered to deep left-center with two out and no one on in the third for his 31st of the season. Freeman doubled with two out in the fifth, and Albies homered to right, making it 6-1.

Anderson (8-5) didn’t need much support. He gave up a run in the first inning when Kole Calhoun doubled in Ketel Marte, who had walked. But after Christian Walker’s leadoff single in the second, Anderson didn’t allow another baserunner in his seven innings. He struck out eight.

Walker greeted Atlanta reliever Chris Martin with a home run, his ninth, in the bottom of the eighth. That ended a streak of 17 consecutive Arizona batters retired.

Freeman’s homer came in the ninth, when Atlanta scored three times against Tyler Clippard. William Contreras singled with one out, went to third on Joc Pederson’s pinch-hit double and came home on Soler’s sacrifice fly. Freeman followed with a deep blast toward the pool in right-center.

Kelly lasted six innings, allowing seven hits and striking out seven. He was charged with six runs. The Diamondbacks (48-104) are tied with the Baltimore Orioles for the worst record in the majors.

WAY, WAY BACK

Baseball historians might point out that Duvall is not the only Braves hitter to ever lose a three-run homer because of a baserunning mistake.

Back in 1959, Harvey Haddix of the Pirates took a perfect game into the 13th inning against the Milwaukee Braves at old County Stadium. With the score 0-0, an error put the Braves’ leadoff man on base, ending the perfecto, and Hank Aaron was intentionally walked with one out.

Slugger Joe Adcock then hit a drive over the fence for an apparent three-run homer. Aaron, however, thought the ball was still in play -- when he saw the runner ahead of him score, he trotted off the field. Adcock, meanwhile, rounded the bases.

The umpires counted Adcock’s homer and said the final score was 2-0. NL President Warren Giles later ruled Adcock should only be credited with a double and made it a 1-0 final.

SMITH RETURNS

Caleb Smith returned to the active roster for Arizona on Wednesday following his 10-game suspension. The left-hander was ejected for having a substance on his glove in a game in Phoenix against the Phillies on Aug. 18. Smith appealed the suspension, but it was upheld earlier this month.

Smith pitched two innings, giving up one hit and two walks while striking out one. He was the second major league pitcher to be suspended since the crackdown on banned substances earlier this season. Seattle’s Hector Santiago drew the first 10-game penalty.

TRAINER’S ROOM

Diamondbacks: SS Nick Ahmed (sore right shoulder) didn’t start again, but Lovullo said he would be available if needed. Josh Rojas replaced Ahmed at short with Ketel Marte playing second base.

"He has some inflammation," Lovullo said. "Just trying to get that down, give him another day."

BRAVES MOVES

Before Wednesday’s game, the Braves recalled IF Orlando Arcia from Triple-A Gwinnett, selected LHP Dylan Lee. They replace RHPs Edgar Santana (paternity list) and Touki Toussaint (bereavement list).

NEXT

The Braves go for a sweep of the four-game series at Chase Field on Thursday afternoon. Atlanta sends Charlie Morton (13-6, 3.49) to face Arizona’s Madison Bumgarner (7-10, 4.56).