McGrady, who was cold shooting from the field early, finished with 17 points, 10 rebounds and 12 assists.
Reserve Bonzi Wells added a season-high 24 for Houston, which has won four of six since losing six straight.
Pau Gasol led the Grizzlies with 23 points and 12 rebounds while Damon Stoudamire had 19 points. Memphis has lost eight of 12.
The Grizzlies came back from a 13-point halftime deficit to get within seven at one point in the third quarter.
But McGrady, who hit only three of his first 15 shots, warmed up in the third by scoring seven points. Yao added 13 as Houston pulled back to an 85-71 lead after three.
Notes: McGrady's other triple-doubles came against Philadelphia (22-11-11) on Feb. 23, 2002 and New Jersey (46-13-10) on Feb. 23, 2003. It was his first with the Rockets. ... Grizzlies C Darko Milicic didn't start due to a strained left ankle. Gasol moved to the center spot and Juan Carlos Navarro started at forward. Milicic, who missed seven games due to a strained left thumb, had been back only two games. ... Yao missed his second free throw of the game, ending a string of 27 straight. It started in the second quarter of the Nov. 26 game at the Los Angeles Clippers. ... Stoudamire equaled his season high for 3-pointers with four.