The deal is a major step aimed at improving a promising pitching staff with a reliable reliever. In the deal, the Astros get righthander Brandon Duckworth and two minor leaguers.
Wagner made his third All-Star appearance last season, going 1-4 with a 1.78 ERA and 44 saves and in 78 games.
"We met with our pro scouts and staff in Clearwater three weeks ago, we prioritized our needs, and decided that the closer should be at the top of the list," said General Manager Ed Wade. "We went through the list of available closers and ranked them. Billy Wagner was at the top of our list. Billy offers a huge improvement for the 2004 Phillies."
The Phillies declined to exercise the contract option on closer Jose Mesa, who lost his job last season.
Wagner, a lefthander, was scheduled to make $8 million in the final year of a three-year contract. He got in hot water when he blasted Houston owner Drayton McLane for what he perceived as a budget too frugal to keep the team competitive.
He is the Astros all-time leader in saves with 225, has a career record of 26-29, an ERA of 5.53, and has 695 strikeouts in 504 1/3 career innings.
Notable deaths of 2014 [PHOTOS]