The Astros dealt Oswalt and a sizable amount of cash to the two-time NL champions for pitcher J.A. Happ and two speedy prospects, outfielder Anthony Gose and shortstop Jonathan Villar.
Oswalt joins a rotation that includes star Roy Halladay, acquired from Toronto in the offseason, and Cole Hamels, the 2008 World Series MVP. Oswalt is scheduled to make debut for the Phillies on Friday night, starting at Washington.
"We're trying to do what we can to get back to the World Series and win it," Phillies general manager Ruben Amaro Jr. said. This was the second straight year the Phillies made a major trade for a pitcher in the days leading up to the July 31 deadline.
Last season, they got Cliff Lee and he boosted them to another NL pennant - Lee was then sent to Seattle in a separate deal on the same day the Phillies acquired Halladay.
The Phillies took a seven-game winning streak into Thursday night's game against Arizona. Philadelphia began the day 3½ games behind Atlanta in the NL East.
St. Louis also had been bargaining for Oswalt. He had a no-trade clause in his contract and could decide whether to accept any deal. "He's pretty excited about coming here," Amaro said.
The 32-year-old Oswalt was 6-12 despite a 3.24 ERA for Houston. The Astros were shut out in five of his 20 starts.
The righty helped the Astros get to the 2005 World Series, but they are far out of playoff contention this year. Oswalt is 4-0 in the postseason.
Oswalt is 143-82 with a 3.24 ERA in 10 seasons with the Astros. He is due about $5.33 million the rest of this season from his $15 million salary and is owed $16 million in 2011. Oswalt's contract has a $16 million mutual option for 2012 with a $2 million buyout. Amaro said the team sweetened the buyout, but wouldn't consider it a "significant" amount.
The Astros seemed set to send about $11 million to the Phillies as part of the deal. Amaro declined to specify the amount.
"That was an important part of this," Amaro said. "We wanted to keep some level of flexibility so we can continue to field a championship-caliber team. Yes, the money did make a difference."
Happ has made one start after missing three months with an elbow injury. The 27-year-old lefty went 12-4 with a 2.93 ERA and finished runner-up for the NL Rookie of the Year award last season.
"This is all I've ever known," Happ said. "I had an idea driving to the ballpark it might be the last time. It was emotional."
The 19-year-old Gose is fast, stealing 36 bases and hitting .263 for advanced Class A Clearwater.
Villar, also 19, stole 38 bases and batted .272 for Class A Lakewood.