Sandberg took over when Charlie Manuel, the winningest skipper in club history, was fired on Friday. The Phillies, shut out by the Dodgers in each of Sandberg's first two games, snapped a four-game skid and won for the fifth time in 26 games.
Andre Ethier homered for the Dodgers, who have lost just nine of their last 51.
Darin Ruf hit a home run to begin Philadelphia's comeback from a two-run deficit. Jonathan Papelbon (3-1) struck out two in a scoreless ninth to earn the win.
Brandon League (6-4), who relieved Paco Rodriguez in the ninth, took the loss.
Los Angeles was beaten for only the second time in 21 road games.
DIAMONDBACKS 4, PIRATES 2
PITTSBURGH (AP) — Adam Eaton's bloop double in the 16th inning drove in two runs, and Arizona outlasted Pittsburgh.
Eaton's career-high fourth hit came during his seventh at-bat, with A.J. Pollock and Didi Gregorius on and two outs. Eaton fought off a 1-0 pitch from Kris Johnson and dunked the ball into shallow left-centre.
Arizona remained five games behind Cincinnati in the race for the second NL wild-card spot. Pittsburgh's lead in the NL Central dwindled to one game over St. Louis.
The Pirates dropped two of three to Arizona, losing their third consecutive series.
Wade Miley limited the Pirates to two runs over eight innings, and Aaron Hill went 4 for 7 to extend his hitting streak to 11 games for Arizona.
Arizona's victory was its 27th in its final at-bat, by far the most in the majors. It also was the Diamondbacks' 36th comeback win — second-most in the majors — and club-record 13th in extra innings.
Six Arizona relievers combined to pitch eight scoreless innings. Brad Ziegler (7-1) had two strikeouts while pitching perfect 14th and 15th innings, and J.J. Putz worked around two walks — one intentional — in the 16th to earn his sixth save.
Johnson (0-1) threw 82 pitches in six innings after being selected from Triple-A Indianapolis earlier Sunday.
REDS 9, BREWERS 1
MILWAUKEE (AP) — Homer Bailey allowed one run and three hits in eight innings, and Cincinnati routed Milwaukee.
Bailey (8-10) won his third straight decision and improved his career mark against Milwaukee to 2-7 with his first win in three starts against the Brewers this season.
Scooter Gennett's double in the second, and Khris Davis' solo shot in the fifth and infield single in the seventh were the only hits for the Brewers. Bailey walked one and struck out eight, including Juan Francisco three times.
Brewers starter Wily Peralta (8-13) allowed five runs. Cincinnati sent 10 men to the plate in the fifth and tacked on four more runs.
BRAVES 2, NATIONALS 1
ATLANTA (AP) — Julio Teheran pitched around trouble through six scoreless innings, and a tired Atlanta bullpen held on in a win over Washington.
The Braves won two of three in the series and stretched their NL East lead over the second-place Nationals to 15 1/2 games.
Four Atlanta relievers made it through the final three innings, preserving the win for Teheran (10-6).
Craig Kimbrel pitched the ninth for his 39th save.
Both teams exhausted their bullpens in the Nationals' 8-7 win in 15 innings on Saturday night.
Freddie Freeman and Chris Johnson hit RBI singles off Gio Gonzalez (7-6) in the first. Gonzalez gave up two hits and no runs in the next six innings.
MARLINS 6, GIANTS 5
MIAMI (AP) — Jeff Mathis hit an early home run, then lined a tiebreaking double in the eighth inning that bounced off centre fielder Andres Torres and sent Miami over San Francisco.
It was 5-all in a back-and-forth game when Ed Lucas led off the eighth with a single against Sandy Rosario (3-1). With one out, Mathis hit a liner to left-centre and the ball dropped in front of Torres' dive and caromed off him.
Chad Qualls (4-1) pitched 1 1-3 scoreless innings and Steve Cishek worked the ninth for his 27th save in 29 chances.
Hector Sanchez singled with one out in the ninth before Buster Posey grounded into a game-ending double play.
Hunter Pence homered and drove in three runs, Brandon Crawford also hit a home run, and Gregor Blanco had three hits for the Giants.
CARDINALS 6, CUBS 1
CHICAGO (AP) — Cardinals ace Adam Wainwright struck out 11 and allowed one run through seven innings, and Jon Jay drove in four runs with a homer and double to lead St. Louis past the Chicago Cubs.
Matt Carpenter singled in two runs in the third to help back Wainwright (14-7), who was in command and allowed just five hits and one walk after going 0-2 in his previous four starts.
Junior Lake drove in the Cubs' run with a double in the sixth.
Wainwright hadn't won since July 21 at home against San Diego and had allowed 14 runs in 28 innings during the span. On Sunday, he faced only one batter over the minimum through the first five innings and only 26 through seven innings.
Chicago starter Edwin Jackson (7-13) allowed three runs, one earned, through six innings.
PADRES 4, METS 3
SAN DIEGO (AP) — Will Venable hit a leadoff homer in the ninth inning to give San Diego a victory over the New York Mets.
Venable sent a 1-2 pitch from Pedro Feliciano (0-2) just inside the right-field foul pole for his team-high 17th home run. Venable, who also drove in a run in the fifth, extended his career-best hitting streak to 15 games.
Huston Street (1-4) worked a scoreless ninth for the win.
Matt Harvey pitched six solid innings for the Mets and regained the NL lead in strikeouts. New York split the four-game series and is 4-6 on an 11-game road trip, its longest of the season.
Harvey, who didn't walk a batter, had his 16th no-decision but lowered his ERA to 2.25, second-best in the majors.