Updated

Jason Castro smoked a tie-breaking three-run home run in the seventh inning, propelling the Houston Astros to a 4-1 win over the free-falling Pittsburgh Pirates in the middle test of a three-game series at Minute Maid Park.

Brett Wallace ripped an RBI single for the Astros, who have won back-to-back games on the heels of a three-game slide.

Dallas Keuchel (3-7) was solid on the mound, allowing one run on four hits and a walk with five strikeouts to win his second consecutive start. Wilton Lopez notched his seventh save of the season with a perfect ninth inning.

"I'm not trying to be too fine and just letting everything work," Keuchel said. "I think I've gotten 10 times better from a mental strategy."

Gaby Sanchez launched a solo home run and Kevin Correia (11-10) yielded four runs -- three earned -- on seven hits with a walk and nine strikeouts for the Pirates, who fell to 4-16 in the month of September.

With the loss, the Pirates fell to three games under the .500 mark for the first time since May 25.

"We're just not finishing plays off," Pirates manager Clint Hurdle said of his club's struggles. "On offense, there wasn't a whole lot to try and develop."

With the contest tied, 1-1, Jed Lowrie began the Astros seventh with a solid base hit up the middle. Matt Dominguez then cued a ground ball to Pirates shortstop Clint Barmes, who booted what should have been an easy double-play ball.

Castro made the Bucs pay for their uninspired defense when he pounded a change-up from Correia deep to right field and just over the outstretched arm of Garrett Jones for his third homer of the season.

Lopez went through Neil Walker, Andrew McCutchen and Jones with ease in the ninth to secure the victory.

Pittsburgh is now 6 1/2 games behind the St. Cardinals in the race for the National League's final wild card spot.

The Astros got on the board in their first at-bat. Scott Moore laced a one-out double to left field, advanced to third on a wild pitch by Correia and scored when Wallace knocked a single into center field.

The Pirates quickly tied the game in the second as Sanchez led off the inning by blasting a change-up from Keuchel deep into the Crawford Boxes.

Game Notes

Correia's nine-strikeout performance matched a career-high. He fell to 7-3 this season against the NL Central ... Pittsburgh has homered 15 times in its last 12 games ... Castro has hit safely in 12 of his last 15 starts ... Pittsburgh went 0-for-3 with runners in scoring position and left three on base.