HOUSTON -- Houston's offense didn't give J.A. Happ much to work with. Good thing he didn't need much help.
Happ allowed three hits and struck out six over seven innings and the Astros beat the Pittsburgh Pirates 2-0 on Wednesday night for a sweep of the three-game series.
"You can do a lot with good pitching," Astros manager Brad Mills said. "What a great job throughout his seven innings. He threw the ball with confidence. His rhythm was good. He got the ball. He threw the ball. It was sure nice to see."
Despite having the worst record in baseball (47-90), the Astros have won five of their last seven overall and seven of their last eight at home. Houston's other sweep this season was against the Chicago Cubs May 30-June 1.
Happ (5-15) had his second strong outing since returning from Triple-A Oklahoma City. He didn't allow a runner past first base and walked one. It was Happ's first major league victory since July 19.
"Obviously, getting ahead of the hitters helped me tonight," Happ said. "It gave me the confidence to kind of attack a little bit. Putting them on the defensive is what I need to do more of and I think I did that tonight.
"Having success is helping and having a little mentality change and being positive out there."
James McDonald (8-7), who had won five of his previous seven decisions, pitched six innings, allowed seven hits, two walks and struck out six.
In the fourth inning the Astros pieced together two runs on a groundout and an infield hit.
Mark Melancon pitched the ninth for his 16th save in 21 opportunities.
Pirates first baseman Garrett Jones made the throw back to McDonald at the plate trying to get Paredes, but it was too late.
"The catcher threw the ball and he didn't go back," Paredes said. "I say, 'I'm safe, go home.' The catcher threw the ball and he didn't come back. I said, 'He's crazy.'"
McDonald tried to make the play.
"He was going to slide, and he could have hit my leg," McDonald said. "It was a big play. It wasn't that bad of a throw. If I was a catcher and had gear on, I would have had no problem stepping across and getting that throw."
Jones tried to make a quick throw.
"I tried to throw and get rid of it quick, and I think James couldn't get his feet set and the throw was up the line a bit," Jones said. "It's a bang-bang play. If there was a throw right on the money, we would have had a better chance to get him. It's tough also for a pitcher to get back there and make that play."
Pirates manager Clint Hurdle added that catcher Ryan Doumit made the right choice in going to first base.
"Ryan made the right play. We have to be able to execute throwing the ball 90 feet," Hurdle said. "I do think that James might have been caught a little bit off-guard. I'm not sure if the positioning of the plate is where it needed to be and the throw was off line."
Pittsburgh's Carlos Lee extended his hitting streak to 12 games with a single in the third and a double off the wall in left in the eighth for a 2-for-4 performance. Lee is hitting .477 (21 for 44) during the streak.
The Pirates traded OF Matt Diaz to Atlanta for a player to be named or cash and sent Triple-A OF John Bowker to Philadelphia for a player to be named or cash. Pittsburgh's J.D. Martinez has 28 RBIs in August, one short of tying the NL rookie record for August. David Justice (1990) and Todd Helton (1998) currently share the record. The Astros will recall RHP Lucas Harrell to pitch Friday night against Milwaukee. Harrell is pitching in place of Brett Myers, whose wife Kim, is expecting their fourth child. Pirates SS Randy Cedeno had his five-game hitting streak snapped.