"I made two pretty good pitches and I just hung a curveball and he hit it out," Wright said. "The situation wasn't that tough. I just didn't execute the way I needed to."
The game ran the gamut of emotions for the Astros, who built a 6-2 lead in the sixth inning before allowing the Pirates to score three times in their half of the sixth and twice in the seventh -- on a two-run homer by Garrett Jones -- to take a 7-6 lead.
The Astros were down to their final strike in the ninth when Castro came off the bench and shot a double into right field against closer Joel Hanrahan, scoring Jed Lowrie -- who was running on the 3-2 pitch -- all the way from first base to tie the game.
"When I got to a three-ball count I was obviously trying to take a pitch and see what happens, and he came back and threw a strike," said Castro, who's hitting .313 in his last 64 at-bats. "That's the goal with two strikes in the ninth like that, you're trying to keep the line moving and get the next guy up and battle as best you can."
The Astros hit the halfway point of the season at 32-49 and in a funk, having lost 26 of their last 36 games. They have lost eight straight on the road, dropping them to 9-30 away from home this season.
"It's been tough," Castro said. "It's hard because we've been in a lot of games and lost some close ones and had some leads that kind of got away from us, and that's probably the most frustrating part is that we're close and we just need to find that next gear to push us over the edge to hold over leads. We're starting to swing the bat."
Trailing, 6-2, the Pirates scored three times in the sixth against Harrell to get within a run and then got a towering two-run homer run by Jones off relief pitcher Brandon Lyon in the seventh to take a 7-6 lead and whip the crowd into a frenzy.
Mills couldn't play the matchups he wanted in the ninth because the Astros were without right-handed reliever David Carpenter and left-handed reliever Fernando Abad, both of whom had thrown three days in a row. He sent in the left-handed Wright, who retired right-hander Gorkys Hernandez before facing Sutton, a switch-hitter batting right-handed.
"We've kind of gone through it an awful lot and these guys have been giving us what they got," Mills said. "They really battled well to get us into where we needed to be."
Harrell, coming off his first career complete game in a shutout win over the Padres, retired 10 of the first 11 batters he faced, including seven by strikeout to raise his pitch count. Sutton led off the fourth with a single and scored on a two-run homer to right field by Andrew McCutchen to slice the lead to 3-2.
Pirates starter A.J. Burnett gave up three straight hits to start the sixth -- a double by Chris Snyder, a bunt single by Harrell and an RBI single by Schafer -- to get pulled from the game, and Lowrie's sacrifice fly later in the inning pushed the Astros lead to 6-2.
Harrell met a similar fate as Burnett, getting pulled from the game after giving up three consecutive singles to start the sixth. Fernando Rodriguez replaced him and allowed all three runners to score, getting Pittsburgh to within one at 6-5, highlighted by a two-run, pinch-hit single from Pedro Alvarez.
Mills thought Harrell's two innings on the bases following a pair of attempted sacrifice bunts that turned into hits took a lot out of him on a hot night.
"He really wore himself out on the bases," he said. "The first time, he was on base all the way the whole inning after the sacrifice bunt turned into a base hit. The second time, he was on base the whole inning and then he wound up scoring. Definitely, on a warm evening like this, there's no doubt that took its toll on him."
Harrell, who's 5-1 with a 1.99 ERA at home and 2-5 with a 6.59 ERA on the road, didn't use being fatigued as an excuse.
"That had nothing to do with it," he said. "It was more about [not] executing."