Updated

With little left to play for in this dreadful season, the Houston Astros embraced the spoiler role on Thursday night.

Pinch-hitter Jed Lowrie delivered a two-run double in the eighth inning and the Astros stung Philadelphia, rallying for a 6-4 victory that ended the Phillies' seven-game winning streak.

The Phillies' surge had got them within three games of St. Louis for the second NL wild-card spot. But the deficit increased to four when the Cardinals won 2-1 at the Los Angeles Dodgers.

"There's a lot of satisfaction in that," Houston reliever Wesley Wright said of beating a team in postseason contention. "They come with a lot on the line and we have a chance to kind of derail that and finish the season on a positive note. So it's a good victory all the way around."

Philadelphia built an early 4-0 lead, but Lowrie's two-out hit put the Astros ahead 5-4.

Matt Dominguez hit a three-run homer for Houston, which has the worst record in the majors.

Houston interim manager Tony DeFrancesco loves the way his team responded against the contending Phillies.

"When you're a team where we're at, just trying to play the season out, you've got to try to motivate them," he said. "We could factor into the end of the season here. Hopefully people will say they're starting to play good and they've got some life and some energy and they're going in the right direction. That's what we want."

Philadelphia's bullpen pitched four scoreless innings after an early exit by Tyler Cloyd, but the relievers couldn't close it out.

Phillippe Aumont (0-1) took over in the eighth with a 4-3 lead and walked Jason Castro with one out. Pinch-runner Jordan Schafer was caught stealing on a strong throw by catcher Erik Kratz from his knees, but Aumont walked Dominguez and plunked pinch-hitter Scott Moore on the foot.

Jake Diekman, the fifth Phillies reliever of the game, gave up Lowrie's hit that stopped a string of 21 consecutive scoreless innings by Philadelphia's bullpen.

Brandon Barnes then singled in Lowrie to make it 6-4.

Wright (1-2) got the last two outs of the eighth for the win. Wilton Lopez allowed a hit in a scoreless ninth for his fifth save.

Kratz snapped an 0-for-16 skid with an RBI double in the second, and the Phillies tacked on three more runs in the third. Juan Pierre and Chase Utley hit consecutive one-out singles and Ryan Howard had a sacrifice fly. John Mayberry Jr. and Kevin Frandsen added RBI singles.

Justin Maxwell and Castro hit consecutive singles in the fourth before Dominguez connected for his third three-run homer in the last seven games, snapping an 0-for-13 string.

Houston starter Lucas Harrell allowed seven hits and four runs in 5 2-3 innings. He is 0-1 with a 4.11 ERA in his last five starts.

Pinch-hitter Pete Orr singled with two outs in the sixth and Harrell issued consecutive walks to load the bases. Harrell was lifted after the second walk, and jawed at plate umpire Bill Miller on his way to the dugout and was ejected.

"It was horrible," Harrell said of his outing. "I couldn't throw anything for a strike ... it's frustrating. The competitiveness of wanting to win kind of got a hold of me today and I let my emotions run a little bit."

He was replaced by Xavier Cedeno, who retired Utley to end the threat.

Cloyd yielded five hits and three runs in three-plus innings.

Cloyd retired his first six batters before Jimmy Paredes singled to start the third. Jose Altuve hit a two-out single and Cloyd hit Fernando Martinez to load the bases before getting Brett Wallace on a grounder.

It was the second tough start for Cloyd, who had his contract selected from Triple-A Lehigh Valley on Aug. 29. He allowed eight hits and four runs in four innings against Colorado on Sunday, but received a no-decision.

NOTES: Frandsen was back in the lineup after missing seven starts with a sore left ankle. ... Houston's Bud Norris was scratched from Friday's start because of a blister on the index finger of his pitching hand. The Astros have a six-man rotation, so each pitcher will simply be moved up a game. RHP Edgar Gonzalez will start on Friday against Philadelphia LHP Cole Hamels. ... Astros reliever Mickey Storey was OK a day after being hit on the side of the face by a line drive which glanced off his hand and shoulder before striking him in the face. He said before the game that he's a bit sore but feels lucky that the injury wasn't worse.