PITTSBURGH (AP) -- If only the Pittsburgh Pirates could take a nine-game sliver like this and extend it over 162 games.
Paul Maholm limited Houston to one run over seven innings to win consecutive starts for the first time all season, and the Pirates turned catcher Jason Castro 's throwing error into their first two runs during a 9-3 victory over the Astros on Sunday.
Maholm (9-15) avoided adding to his NL-leading loss total, permitting Carlos Lee 's two-out RBI double in the first before shutting out Houston over the next six innings. The left-hander also pitched seven innings while beating St. Louis 5-2 on Tuesday, his first win since Aug. 3.
The Pirates (55-100) added on seven runs during their final two at-bats to finish 7-2 on their final and most successful homestand of the season - avoiding a 101st loss that would have guaranteed them their worst season since they dropped 104 games in 1985.
"We're trying to make people remember we're still playing hard around here and things are moving in the right direction," said rookie Neil Walker , who drove in three runs. "We're trying to gain a nice head of momentum going into the offseason and going into next year."
Their 55-100 record during a record 18th consecutive losing season suggests they still have a long way to go. Still, manager John Russell said, "We're getting close and I think the people know that."
Russell is under contract through next season, but it is possible he managed his last game at home. The Pirates are 184-294 in his three seasons, their worst such stretch since the mid-1950s.
"We put a lot of focus on this homestand. Now we need to take it on the road and see what we can do," Russell said.
To date, no team in nearly 50 years has done less on the road than the Pirates.
They went 40-41 at PNC Park but are 15-59 away from there, putting them on pace for the NL's worst road record since the 1963 Mets went 17-64. The 1962 Mets (18-62) are the only other club in either league during the expansion era to win fewer than 20 road games during a 162-game season.
Pittsburgh, which plays three in St. Louis starting Monday and four at Florida after that, has lost 45 of its last 51 road games and has been outscored 432-228 for the season on the road.
"We need to finish up these next seven and expect to do what we did in these last nine," Maholm said.
Houston starter J.A. Happ (6-3) held the Pirates scoreless on two hits over five innings before walking Garrett Jones and allowing Pedro Alvarez 's single in the sixth. Jones took off from third on Ronny Cedeno 's grounder to third baseman Chris Johnson , who had plenty of time to get the runner at the plate only to have Castro mishandle the throw.
Astros manager Brad Mills said Johnson waited too long before throwing, resulting in an unnecessarily close play.
"The error got us behind the 8-ball," Mills said.
Alvarez, who wound up at third, then scored on Andy LaRoche 's sacrifice fly. LaRoche drove in his second run in as many games after previously not having an RBI since July 21.
Alvarez and Walker each had a two-run double in his final at-bat. Alvarez has 13 RBIs in six games.
Hunter Pence hit his 25th homer for Houston in the eighth against reliever Evan Meek , briefly making it 5-3. Pence went 2 for 3 while hitting .472 (25 for 53) with four homers and 14 RBIs against Pittsburgh.
Happ took the loss despite limiting Pittsburgh to four hits, all singles, striking out four and walking two over six innings. He is 3-1 in his last seven starts, but Houston has lost each of his last four.
"I didn't feel like they hit the ball hard," Happ said. "I felt I was able to keep the ball out of the middle of the plate for the most part, but just came up short."
Notes: Maholm was 2-2 with a 1.82 ERA in four starts against the Astros, who are 27-18 against left-handed starters. He is 6-1 against them in eight starts at PNC Park. ... The Astros went 11-4 against Pittsburgh. ... The Pirates averaged 19,919 while drawing 1,613,399 in 81 home dates during one of their best seasons weather-wise in decades, up slightly from 1,577,853 in 2009. ... The Pirates won't have a pitcher with double-digit wins for the second time in three seasons unless Maholm wins Friday at Florida.