The Astros had been blanked through the first seven innings, but they roughed up Evan Meek (4-4) when he entered the game in the eighth. Angel Sanchez delivered a one-out single and Hunter Pence drew a walk before Lee hit an 0-1 pitch over the wall in left for his 15th homer of the year.
Consecutive singles by Geoff Blum, Chris Johnson and Brett Wallace accounted for a fourth run.
Wilton Lopez (4-0) gave up a hit during one relief inning to get the win and Brandon Lyon allowed two base runners without a run scoring in the ninth for his third save.
Brett Myers went seven innings as Houston's starter, giving up a run on seven hits with seven strikeouts.
Neil Walker singled home Pittsburgh's run in the third.
The Pirates have lost five in a row and dropped eight straight on the road. The teams have played seven times in Houston this season and the Astros have won them all.
Copyright 2010 United Press International, Inc. (UPI).