The Phillies saw their 7-1 lead evaporate after the Dodgers used a four-run eighth to tie the game 7-all.
In the ninth, the Phillies scored a run on a wild pitch by reliever Daniel Hudson with the bases loaded. Harper then hit a sacrifice fly to give the Phillies a two-run lead. Hudson (1-3) took the loss.
In the bottom of the ninth, Los Angeles loaded the bases against former Dodgers pitcher Corey Knebel. Austin Barnes flew out to right, Cody Bellinger fouled out to left, and Chris Taylor flew out to center as Knebel earned his seventh save in the wild win.
"I thought we did a great job of battling," Harper said. "As good teams go through, you're going to sometimes make mistakes and that happened in this game but we can't let that happen again. That's not what good teams do. It's not what teams who are fighting to win a championship do. I think everybody in here knows that."
Harper was 2 for 4 with 3 RBI. He hit a solo home run in the first inning, his seventh of the season. Earlier in the day, Harper got confirmation he had a small tear in his right elbow and will need a platelet-rich plasma injection Sunday.
"It was good to know what was going on and put it behind me and focus on the game," Harper said. "There's nothing really I can do to help my arm or anything like that. Take that time I need and keep my bat in the lineup."
The reigning NL MVP can't throw for four weeks, but he can certainly still hit from the designated hitter spot as he did once again on Thursday.
"I think he's getting more comfortable there," Phillies manager Joe Girardi said of Harper in the DH role. "Part of me thinks it might have given him peace to understand exactly what's going on and what the next step is. I think he's starting to embrace what he needs to do to help this team win."
Johan Comargo also homered for the Phillies, a two-run shot in the second inning. Andrew Bellatti (1-0) worked 2/3 of a inning and picked up the win.
Zach Wheeler, just reinstated off the COVID-related injured list, didn't factor in the decision after allowing three earned runs on six hits in 5 1/3 innings.
"I felt good about the outing. I didn't really have my legs underneath me," Wheeler said. "Kind of felt like Jell-O. The results were there for the most part. The last inning kind of got me for two runs. Other than that, felt good with what I had."
Down 7-3, the Dodgers rallied and tied the game with four runs in the eighth. They loaded the bases against reliever Jose Alvarado. Will Smith drove in a run and Justin Turner hit a pinch-hit double to score two runs, pulling the Dodgers within 7-6. Chris Taylor singled in a run to tie the game at 7. Hanser Alberto bunted into a fielder's choice as the Phillies threw out Austin Barnes - running for Turner - at the plate, and Freddie Freeman popped out to third to end the inning.
Cody Bellinger hit a solo home run in the third inning to start the comeback after Wheeler had retired the first six batters of the game.
Dodgers starter Tyler Anderson allowed 10 hits and seven earned runs in six innings. He gave up two home runs.
"There were a lot of good things, but most of them didn't come when I was pitching," Anderson said. "It was not a good day out there."
STRIKE 'EM OUT
Yency Almonte made his Dodgers' debut after his contract was selected from Triple-A Oklahoma City. Almonte pitched two scoreless innings and retired all six batters he faced, the final four by strikeout.
Phillies: DH Bryce Harper (small tear right elbow) will miss Sunday's game against the Dodgers with a PRP injection. He might miss Tuesday's game in San Diego, but will continue to be in the lineup as the designated hitter. He can't throw for four weeks.
Phillies: RHP Kyle Gibson (3-1, 2.94 ERA) earned the win against the Mets after a quality start, allowing two runs in six innings. Philadelphia has won four of the six games he' has started.
Dodgers: LHP Clayton Kershaw (4-0, 1.80 ERA) pitched seven scoreless innings and allowed five hits in a road win against the Chicago Cubs. He has won four of his six starts this year and had no decision in the other two.
Phillies retake lead on wild pitch
Daniel Hudson throws one to the backstop to put Philadelphia back on top.