Miami(57-50) rocketed out to a 2-0 lead in the bottom of the first. After a base hit by Luis Arraez to right field, Jorge Soler followed with a two-run homer to left-center field on a 1-1 pitch for his 25th home run of the season.
Philadelphia(57-49) matched it with two runs in the top of the fourth. Johan Rojas doubled into left field to score Park Vista High School grad Trea Turner and Brandon Marsh.
The Phillies moved ahead 3-2 in the top of the seventh. Bryson Stott hit a sacrifice fly to left field and Kyle Schwarber crossed the plate.
It became 4-2 for the Phils in the eighth inning. Alex Bohm drove in Rojas with a single through the right side.