Harden scored 18 points in the fourth quarter and Houston outscored Cleveland 35-16 in the period.
Both teams missed shots on their next possession, but Trevor Ariza‘s 3-pointer from the corner with 17 seconds left gave Houston a 101-97 lead.
Irving scored 31 points for Cleveland, which fell to 1-3 this season and 4-13 over the last two when James doesn’t play.
Cleveland (52-22) leads Toronto by 2 1/2 games for the top seed in the East. Houston (37-38) moved a half-game ahead of Dallas for the eighth spot in the West.
Michael Beasley scored 17 points, while Ariza added 15 for Houston. Howard had 11 points and 11 rebounds.
Houston won despite a dreadful night from the foul line, where the Rockets were 21 of 42. Howard was 7 of 22.
Cleveland led 91-83 on Thompson’s basket with 6:36 to go, but the Rockets used a 12-0 run to go ahead. The Cavaliers didn’t score again until Irving hit a free throw with 2:44 left. Irving’s jumper with 2:17 to go tied the game at 94.
Cleveland led 62-42 early in the third quarter before Houston rallied.
Cleveland coach Tyronn Lue announced Monday that James would sit out the game as the Cavaliers try to rest their key players as much as possible over the final games of the regular season.
James, dressed in a sports jacket, jumped up from the bench several times to encourage his teammates and joined Lue near midcourt to bark out instructions late in the second quarter.
Cleveland made six 3-pointers in the second and built a 59-40 halftime lead.
Rockets: Houston scored 14 points and made 5 of 18 shots in the second quarter. … The Rockets snapped a four-game losing streak on the road.
Cavaliers: James is four points away from passing Dominique Wilkins for 12th place on the NBA’s career scoring list. The four-time MVP has 26,665 career points.
Rockets: Host Chicago on Thursday.
Cavaliers: Host Brooklyn on Thursday
Copyright 2016 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.