General manager Daryl Morey confirmed the signing on Twitter.
McHale, who has guided the Rockets to a 20-7 start despite a knee injury to center Dwight Howard, was working under the final year of his current contract. He is 153-104 in three-plus seasons with the Rockets and 192-159 in his six seasons as an NBA coach, two of which he spent with the Minnesota Timberwolves.
He has been instrumental in transforming the Rockets into a Western Conference contender after their acquisitions of Howard and James Harden over the past several years.
The Rockets, who traded for wing Corey Brewer earlier this week, are attempting to make more moves in the short term.
On Wednesday, Josh Smith committed to the Rockets, according to ESPN sources. Playing for a winning team with a chance to win a title led to Smith's decision.
The Pistons waived Smith on Monday, less than halfway through the four-year, $54 million contract he signed before the 2013-14 season.
Information from ESPN.com senior NBA writer Marc Stein and ESPN The Magazine's Chris Broussard is included in this report.