Zach Eflin (3-6) allowed two runs and three hits in six innings, and a Philadelphia bullpen that had blown 22 of 40 save chances coming in held the lead for a change. Bailey Falter, Archie Bradley and Ranger Suarez combined for three innings of one-hit, scoreless relief. Suarez earned his first professional save with a perfect ninth.
''He just pounded the zone like he knows how,'' Harper said. ''Very impressive.''
The Phillies will go for a three-game sweep in the series finale on Sunday.
''If we can get a sweep against them, what a great weekend it will be,'' Harper said.
Manny Machado hit his 13th homer, a two-run drive. The Padres have lost three straight after winning 11 of 12.
''Tonight we probably didn't deserve to win,'' San Diego manager Jayce Tingler said. ''We didn't do enough in all of the categories.''
The start was delayed 2 hours, 1 minute due to rain, and the game was stopped by rain for 45 minutes with two outs in the bottom of the fourth.
Philadelphia went ahead 3-2 in the sixth on Harper's one-out sacrifice fly to deep right off Yu Darvish (7-3) after J.T. Realmuto tripled off the wall in right.
Hoskins added a two-out RBI double to left. Hoskins' at-bat was extended when first baseman Eric Hosmer lost his foul ball behind the first-base bag in the lights.
A night earlier, the Phillies wasted a 3-0 lead in the ninth, their eighth blown save in nine games, before Brad Miller's winning double. Suarez replaced Jose Alvarado in the ninth and surrendered Jurickson Profar's tying, two-run double.
This time, Fernando Tatis Jr. flied out to deep center, Jake Cronenworth struck out and Machado fouled out to third.
''He hits his spots,'' manager Joe Girardi said. ''I thought it was best to bring Ranger in.''
Suarez, who has been used in varying roles, relished the opportunity to close and said he'd welcome another chance if that's what the team needs.
''I'll be ready whenever they call my name,'' he said through an interpreter.
Machado's line drive over the wall in center put the Padres ahead in the first.
Harper golfed the first pitch he saw from Darvish in the second inning, a 93 mph fastball, off the scoreboard hanging from the second deck. The 113.5 mph drive was the hardest-hit home run off Darvish since Statcast tracking started in 2015.
Two batters later, Hoskins drove his first pitch, another 93 mph fastball, over the wall in left.
Darvish gave up four runs and six hits in six innings with eight strikeouts and a walk.
A fight broke out in the right-field stands in the bottom of the eighth inning. Padres relievers jumped off the bench to the front of the railing in the bullpen to see what was happening. It appeared an ambulance was called and a fan was removed on a stretcher. Video posted to Twitter following the game showed a fan being shoved down a flight of concrete steps.
LHP Blake Snell (3-3, 5.290), who missed his previous turn to due illness, will face Philadelphia RHP Vince Velasquez (3-2, 4.22) in the series finale on Sunday.
More AP MLB: https://apnews.com/hub/MLB and https://twitter.com/AP-Sports
Copyright 2021 STATS LLC and Associated Press. Any commercial use or distribution without the express written consent of STATS LLC and Associated Press is strictly prohibited.