Brandon Marsh hit a three-run double and a single and Nick Castellanos added two hits and two RBI for the Phillies, who improved to 78-63.
Eight different Phillies scored one run.
Phillies starter Aaron Nola tossed 4 1/3 innings and allowed seven hits and four runs with six strikeouts and no walks.
Jeff Hoffman (4-2) earned the win with 1 2/3 innings of relief.
Hoffman, Gregory Soto, Jose Alvarado and Craig Kimbrel combined to throw 4 2/3 scoreless innings.
Garrett Hampson homered and singled twice and Jazz Chisholm Jr. added two hits for the Marlins.
Jacob Stallings and Josh Bell each contributed an RBI double for the Marlins (73-69), who are 1 1/2 games behind the Arizona Diamondbacks for the National League's third wild-card spot..
Marlins starter Johnny Cueto (1-4) lasted only 3 2/3 innings and gave up five hits and five runs with three strikeouts and three walks.
In the bottom of the eighth, Castellanos earned a rare walk with two outs and pinch hitter Cristian Pache lined out to left.
Hampson led off the ninth with a single and Xavier Edwards struck out. Stallings flied out to right and Luis Arraez struck out to end the game.
The Phillies went ahead 5-0 in the second when Castellanos hit a two-run double down the left field line and Schwarber added a mammoth three-run homer to center. It was Schwarber's 42nd home run of the season and it sailed an estimated 425 feet.
Cueto threw 50 pitches in the second inning.
The Marlins managed two hits through the first four innings, a double by Jake Burger and a single by Chisholm.
In the fifth, Hampson lined a solo homer to left, Stallings and Bell each added an RBI double as the Marlins closed within 5-3. Burger also contributed an RBI sacrifice fly to left to pull Miami within one run.
The Phillies struck back in the bottom of the fifth with a three-run double by Marsh for an 8-4 advantage.
—Field Level Media