AP photo by Ben Margot / Guillermo Heredia slides into home plate to score for the Atlanta Braves, getting past San Francisco Giants catcher Curt Casali, right, on a wild pitch by Sammy Long, center standing, in the eighth inning of Sunday's game in Atlanta. At left, home plate umpire Chris Segal makes the call with Atlanta second baseman Ozzie Albies, rear, also looking on.

ATLANTA — The Atlanta Braves went from famine to giant feast in no time at all.

Austin Riley and Jorge Soler homered in the fourth inning, and Ian Anderson pitched into the sixth in his return from the injured list as the Braves beat the San Francisco Giants 9-0 on Sunday afternoon. Atlanta bounced back quickly from a 5-0 loss Saturday night to win two of three in a series between National League Division Leaders.

Soler opened the fourth inning with his 20th homer of the season, a drive into the seats in left field. Freddie Freeman followed with an infield single, and Riley then launched his 28th homer of 2021 into the seats in left-center. Both homers came off San Francisco starter Anthony DeSclafini, who was also coming off the injured list and did not make it out of the inning.

Eddie Rosario added a two-run triple in the sixth for the the NL East leaders, and in the eighth Ozzie Albies connected for his 23rd homer of the year. Atlanta (70-59), seeking its fourth straight division title, remained 4 1/2 games ahead of the second-place Philadelphia Phillies and 7 1/2 games ahead of the third-place New York Mets.

The Braves had lost three of four after a nine-game winning streak, with that string of victories all on the road.

Next up is a seven-game trip that starts Monday against the Los Angeles Dodgers, who rallied from a 3-1 deficit in games to beat Atlanta in the NL Championship Series last year and went on to win the World Series. The Braves will then head to Denver for four games against the Colorado Rockies, whose record at home is among the very best in the majors this season.

"It's not going to get any easier next week, that's for sure," Atlanta manager Brian Snitker said.

The Giants, who have the best record in the major leagues at 84-46, had won 15 of 19 games and held a two-game advantage over the second-place Dodgers in the NL West entering Sunday.

"I have a lot of belief in this club, and every time we go on the field I think we're going to win that day's baseball game, but right now I'm not pleased with the way we played this one," San Francisco manager Gabe Kapler said.

Anderson (6-5) made his first start since July 11 after missing 39 games with right shoulder inflammation. He pitched out of jams in the first with two runners on and in the third with a runner on third.

"By the time I made that first rehab start, I was feeling pretty good," Anderson said. "You just stay with the process and you feel you could be ready sooner, but you've got to build up pitches to get to where I needed to be to pitch today. Give Snit and the team 90-plus pitches."

The Braves optioned right-hander Edgar Santana to make room for Anderson.

Albies doubled and homered for his 62nd and 63rd extra-base hits, most in the NL, and the Braves improved to 18-6 with the 24-year-old second baseman batting leadoff.

DeSclafani (11-6) had been sidelined with right ankle pain since Aug. 18. He retired the first six batters he faced before Rosario singled to begin the third. DeSclafani stranded him at second with a strikeout of Albies.

DeSclafani left after a trainer came out to see him when Dansby Swanson reached on an infield single with no outs in the fourth. He gave up three runs and six hits. Kapler said it was a strategic decision to take him out, and DeSclafani said he could have kept pitching.

As of Sunday evening, the Dodgers had yet to announce their starting pitcher for Monday night's series opener against Atlanta, but the Braves will begin the three-game set with Drew Smyly (9-3, 4.54 ERA) on the mound. The 32-year-old left-hander has won his past seven decisions in a span of 14 starts, with his most recent loss on May 26 against the Boston Red Sox.