Castillo was placed on outright waivers by San Francisco on July 13 and the Astros claimed him a week later. To make room for Castillo on the roster, Houston sent infielder J.R. House to Triple-A Round Rock.
Castillo hit .244 with 35 RBI and a career-high 28 doubles for the Giants this season. He has played in 577 games in five seasons with Pittsburgh and San Francisco.
Also, third baseman Geoff Blum's single in the second inning Friday night enacted a clause in his contract that guaranteed him another year in Houston.
"I've made 250 plate appearances for the last five or six years, so that's what we were kind of shooting for," Blum said. "I feel real good about it."
A .250 hitter in his 10th season, Blum has a career-high 12 homers this season. He is in his second stint with Houston and has played for Montreal, Tampa Bay, the White Sox and San Diego.