PHILADELPHIA -- The Phillies were nine outs away from completing a four-game sweep of the best team in baseball when what has been a strength of late bent Thursday afternoon.
Andre Ethier hit a pinch-hit homer and Cody Bellinger later followed with a RBI single in the seventh inning off Philadelphia's bullpen and the Dodgers held on for a 5-4 win at Citizens Bank Park to snap a four-game losing streak.
Los Angeles' magic number to clinch the National League West is one. The Dodgers are three wins shy of their first 100-win season since 1974.
Walker Buehler earned his first career win with a scoreless seventh inning. The Dodgers' bullpen pitched six innings after starter Kenta Maeda went three frames.
Kenley Jansen was spotless in 1 1/3 innings for his 39th save.
The Phillies' bullpen came into Thursday's game as the NL's best since Aug. 27 with a 2.37 ERA. Ricardo Pinto (1-2) got the loss after allowing two runs on two hits in one third of an inning.
Dodgers third baseman Justin Turner left the game after the first inning with a right thumb contusion. X-rays were negative. He was hit in the thumb by a 91 mph fastball by right-hander Mark Leiter Jr.
Philadelphia rookie sensation Rhys Hoskins continued to grow his legend with another big hit, as he broke a 2-2 tie in the bottom of the fifth inning with a two-run double.
The first baseman was 1-for-4 with two strikeouts and left three on base.
In the four-game series, however, Hoskins drove in six runs, had two doubles, walked four times and collected four hits. Thursday was his 16th multi-RBI game. He has 45 RBIs in 41 games since being called up on Aug. 10.
Both teams fell victim to sloppy defense.
Los Angeles capitalized on a two-base error by Aaron Altherr to grab a 1-0 lead in the first.
Chris Taylor led off the game with a single and reached third base on Altherr's error. Taylor would later score on a sacrifice fly by Yasiel Puig.
Los Angeles took a 2-0 lead in the third inning after Curtis Granderson plated Bellinger with a sharply hit single Hoskins couldn't handle. Hoskins was charged with an error.
Both of the Dodgers' first two runs were unearned.
One of the two runs Hoskins drove in was unearned because of an error by Chase Utley.
NOTES: Philadelphia is 32-34 since the All-Star break and has won seven of its last 10 games. ... Dodgers 2B Chase Utley, the former Phillies' standout, was 0-for-3 on Thursday. He was 2-for-11 with a triple and a RBI in the series. He is now 5-for-24 with two home runs, a triple and six RBIs at Citizens Bank Park as an opposing player. ... The Phillies head to Atlanta for their final three road games of the season. RHP Ben Lively (3-6, 3.94) faces LHP Sean Newcomb (3-8, 4.32) in Game 1 of a three-game set. ... Los Angeles returns home after a 10-game road trip to open up a three-game series with San Francisco. LHP Rich Hill (10-8, 3.60) opposes RHP Jeff Samardzija (9-14, 4.42).