The Warriors shut down Yao Ming, forced plenty of turnovers (24) and shot well from 3-point range (16-of-35), all things Coach Don Nelson thought they needed to do to win.
But before all that, the Warriors got a boost when McGrady left the game with a back injury in the first half.
"The basketball gods were with us, because Tracy wasn't able to play," said Stephen Jackson, who scored 17.
Baron Davis had 25 points and 10 assists for the Warriors, who began the night 1½ games behind the Los Angeles Clippers for the final playoff berth in the Western Conference.
Golden State won for the 11th time in 14 games, but for only the ninth time on the road this season.
"We've still got seven more games we need to fight and win," said Richardson, who went 9-for-17 from the field and also grabbed nine rebounds. "We are having fun with it, we're celebrating. But we've got to keep fighting."
Luther Head hit seven 3-pointers and scored 30 points, both career highs, ably filling in for McGrady, who left in the first quarter with a stiff lower back.
But Yao was surrounded and smothered all night by Golden State's big men and had his worst game since he scored two points and broke his right leg against the Los Angeles Clippers in December.
With McGrady sidelined, the Warriors concentrated on swarming Yao and they succeeded in wearing him out.
"We were just trying to be very active on him," said 6-foot-9 Al Harrington. "He was frustrated. He was sucking his teeth the whole time. He knew what we were trying to do. He knew it was going to be a long night."
Golden State forced nine turnovers in the first quarter, most of them failed entry passes to Yao.
"We knew that they were going to front me," Yao said. "We were hesitant in the beginning of the game on the shot, on the drive, on everything."
The All-Star center finally broke free for a layup with 6:12 left in the opening quarter, but Richardson answered with a 3-pointer to put Golden State up 19-12.
McGrady missed his first three shots and went to the bench 7 minutes into the game. The Rockets initially said McGrady wasn't injured, then announced at halftime he was out for the game.
The Rockets started the night 1½ games behind Utah in the race for the No. 4 playoff spot in the West and home-court advantage in the first round.
McGrady said he was "questionable" for Friday's game against Portland. With the higher seed slipping away, McGrady said he may take extra time to make sure his injury heals.
"We're in (the playoffs)," McGrady said. "There's no question we're in. I'm not going to try to rush back at all until I'm ready."
The Warriors built a 10-point lead in the first half, but Rafer Alston and Shane Battier sank 3-pointers late in the half to cut Golden State's lead to 57-52 at the break. Alston scored 18 in the game.
The Warriors opened an eight-point lead in the third quarter, but Battier hit two 3-pointers and Alston scored on a breakaway layup to tie the game at 62.
Golden State ended the third quarter with a 15-4 burst, finished by Richardson's 3-pointer with 6.1 seconds left. Richardson tacked on two more 3-pointers early in the final quarter as the Warriors extended the lead to 90-74.
Head rallied the Rockets to within 10 with two more 3-pointers to match his career high. He swished one more with 3:53 left to cut Golden State's lead to 99-93.
Houston got within four before Jackson calmly sank a 3-pointer near the 2-minute mark to put Golden State up 103-96.
Juwan Howard hit a free throw with 1:48 remaining, but Davis swished a fadeaway 20 seconds left to put the game away.
Yao took only four shots, hitting two of them. He grabbed 11 rebounds, but was never a factor in the game's outcome.
"I was not totally ready and prepared to play against this team," Yao said. There was at least one man on me when I was without the ball, and there were at least two men on me when I did have the ball."
- Golden State's 16 3-pointers were two shy of a season high and one short of the most by a Houston opponent this season.
- Head was back in the lineup after missing the last two games with a bruised right shoulder.
- Houston's turnover total was one shy of a season high.