Yao sank 13 of 16 field goal attempts and 14 of 18 free throws as the Rockets won for the sixth time in their last eight games.
Chris Bosh led seven Toronto players in double-figures with 16 points. Donyell Marshall had 15 points and 12 rebounds for the Raptors. who are 1-1 in the post-Vince Carter era and 2-14 on the road this season.
Toronto missed seven of its first eight shots and fell behind 12-3 after the first five minutes of play.