The trade was announced following Arizona's 2-0 victory over the Cincinnati Reds. Perez joins a surprising Houston team that has a 1 1/2-game lead in the AL West and is trying to hold off the second-place Los Angeles Angels.
"They're in a good spot right now," Perez said. "I would love to help wherever they need."
The 33-year-old Perez is 2-1 with a 3.10 ERA in 48 appearances. He leaves Arizona with a 19-game scoreless streak that is tied for the third-longest in Diamondbacks history.
The veteran pitcher said goodbye to teammates and Diamondbacks staff in the clubhouse late Friday. He can become a free agent after the season and didn't rule out a return to Arizona. He has a home in the area.
"I know this team is going to be in the playoffs," said Perez, who set a club record for strikeouts by a left-handed reliever with 76 last year.
Arizona gets 19-year-old lefty Junior Garcia in the deal and will call up another left-hander, Keith Hessler, from Triple-A Reno to fill Perez's spot in the bullpen.
Garcia is 3-1 with a 0.96 ERA and 26 strikeouts in a combined nine games (six starts) between Class A Tri-City and rookie-level Greeneville.
The swap came a week after baseball's deadline for trading players without placing them on waivers.
"I was taken by surprise," Perez said. "Sometimes you feel nervous because, you know, you're going to go to a new organization."
Perez said he found out he'd been dealt right after Friday's game ended.
"It's a really good organization, and I know they're going the right way," Perez said of the Diamondbacks. "I'm just thankful for all the opportunity they gave me."