HOUSTON — For the second time in three nights, the ending of a game between the Rockets and Nuggets came down to one player driving to the rim with a chance to lift his team.

The difference Monday night: a potential MVP was playing the role of closer.

James Harden followed up a 40-point triple-double by going coast to coast for a go-ahead layup with 2.4 seconds left that handed the Nuggets a 125-124 loss at the Toyota Center.

The defeat trimmed the Nuggets’ lead for the final playoff spot in the Western Conference to a mere half-game over Portland.

“I felt like Usain Bolt,” Harden said of his hero’s finish.

The Nuggets felt sick.

Denver had a shot at a game-winning play of its own, but Nikola Jokic’s sideline inbounds pass toward the rim for Mason Plumlee was knocked away, sending 16,080 fans who helped foster a playoff atmosphere into a euphoric state.

“This is a tough loss,” Plumlee said. “We played really well down the stretch and gave ourselves a chance to win, but we just couldn’t pull it out.”

This felt like the postseason. With three weeks left in the regular season, Denver already is in must-win mode as the race for the final playoff spot in the Western Conference clasps tighter than the rat-tat of a snare drum.

And it felt like the playoffs because two teams that score baskets as well as any in the NBA kept trading haymakers.

The advantage went to the team with a player who is comfortable throwing knockout blows. Harden finished with 39 points, and the Rockets needed them all in what Nuggets coach Michael Malone called “a shootout at the O.K. Corral.”

Will Barton, whose would-be game-tying shot in the closing seconds Saturday bounced off the rim, nearly found redemption. He hit a 3-pointer to pull the Nuggets within two points with less than a minute left. Then he completed a tough three-point play to put Denver up 124-123 with 42 seconds left.

The Nuggets had the ball after a Harden miss with under 10 seconds left and a chance to seal the game. Instead, Jameer Nelson’s wayward jumper fell into Harden’s arms and the guard was off to the races. The Nuggets never found Harden as he coasted straight to the front of the rim for a virtually uncontested score.

“They don’t call a timeout because they know Harden has it against a defense that is in transition, retreating,” Malone said. “It’s a great time to attack a team, and we never got him under control. We never got in front of him to square the ball up.”

As if scoring 79 points in two games wasn’t enough, Harden batted away the Nuggets’ last lob attempt to secure the victory. The loss dropped the Nuggets to 3-9 in one-possession games.

“I put a spin on the ball, but the ball just fell down and came up short,” Jokic said. “I think it was a good play, but we didn’t make it.”

The Nuggets corrected the two major mistakes that plagued them during Saturday’s loss. After missing 11 free throws at home, Denver hit 18-of-23 on Monday. The Nuggets missed 18 layups in the first loss. They converted inside with much greater frequency in the rematch and shot 45-of-89 (50.6 percent) overall.

But new issues cropped up. Namely, the 3-point defense and 21 turnovers that turned into 27 Houston points.

Still, the Nuggets used an 8-2 spurt to take a 97-94 lead into the start of the fourth quarter. Then the NBA’s best outside shooting team caught fire. The Rockets buried 3-pointers on three consecutive possessions at the start of the fourth quarter, and the shootout was on.

Denver thought it had landed the final shot. The Beard had other ideas. And he had the ball. It was a heartbreaking combination for the Nuggets.