Harden scored 27 points and the Rockets rallied from a 20-point deficit for a 106-100 victory over the Cavaliers, who rested James.
Cleveland led 62-42 early in the third quarter before Houston, fighting to make the playoffs, roared back. Harden scored 18 points in the fourth and Houston outscored Cleveland 35-16 in the period.
"That's what the first three quarters were for -- to figure out what they were doing," Harden said. "Even when we got down 20 points, we felt confident because they weren't shooting the ball well, even when they were winning."
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.
The victory marked the 12th time Houston has come back from a double-figure deficit to win a game.
"I don't think we pay attention to the score at all times, honestly," Howard said. "Tonight, we just kept fighting and pushing through, so I'm happy."
Cleveland (52-22) leads Toronto by 2 1/2 games for the top seed in the East. The win moves Houston (37-38) a half-game ahead of Dallas for the eighth spot in the West.
"A few plays didn't go our way in the fourth quarter and that kind of cemented them getting back in the game," Irving said.
Michael Beasley scored 17 points while Ariza added 15 for Houston. Howard had 11 points and 11 rebounds.
Cavaliers forward Tristan Thompson, who played in his 362nd consecutive game, the longest streak in franchise history, scored 16 points and had 10 rebounds. Kevin Love added 13 points and 11 rebounds.
Houston won despite a dreadful night from the foul line where the Rockets were 21 of 42 and 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 but Houston then went ahead for good.
"They got stops and we couldn't make a shot," Cleveland coach Tyronn Lue said. "They were able to get out in transition and that kind of got James Harden going. That got him feeling good about himself."
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 suit, 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, but finished 14 of 40 from behind the arc.
Rockets guard Patrick Beverly, who hit a critical 3-pointer in the fourth quarter, has a simple theory when it comes to Houston being successful.
"The thing about us is to not get in our own way," he said. "When we do that, we're fine."
Lue praised Thompson for his durability during his consecutive-games played streak.
"There are a lot of times when guys are sick or you could be hurt and he still plays through the pain," Lue said. "For a guy who plays hard like he does and takes the pounding he does, it means a lot. It's a tribute to him."
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 all-time scoring list. The four-time MVP has 26,665 career points.
Rockets: Host Chicago on Thursday.
Cavaliers: Host Brooklyn on Thursday.
Up 3-1, Dwight Howard says Los Angeles Lakers' job 'not finished'
Dwight Howard echoed Kobe Bryant's comments from more than a decade ago on Friday, saying that despite their 3-1 advantage, the Lakers' job is not finished.
Klay Thompson takes part in full practice 470 days after tearing ACL in Finals
Klay Thompson took part in his first full practice 470 days after tearing his ACL in Game 6 of the 2019 NBA Finals, an encouraging sight Friday for Warriors coaches and players.
Sources: Former Pelicans GM Dell Demps agrees to join Jazz as an assistant coach
Former New Orleans Pelicans general manager Dell Demps has agreed to join the Utah Jazz as an assistant coach, reuniting with head coach Quin Snyder, sources tell ESPN.