Farnsworth, 38, was roommates with Astros manager Bo Porter back during his minor league days. He can earn more than $1 million with incentives, according to Jon Heyman of CBSSports.com.
Farnsworth was released by the Mets a few days ago despite spending a few weeks as their closer. He had a 3.18 ERA with a 1.41 WHIP and three saves in 17 innings for New York before getting cut.
Righty Paul Clemens was sent to Triple-A in a corresponding roster move. The 26-year-old has a 4.08 ERA and a 1.47 WHIP in 17 2/3 innings for the Astros this year.
Houston comes into Saturday with the worst bullpen ERA (5.56) and WHIP (1.59) in all of baseball.