EAST RUTHERFORD, N.J. (AP) -- Tracy McGrady knew it would take a little while for him to get comfortable again on the court.
"Coming into the game, I was concentrating on just getting into the game, playing defense and rebounding, getting my legs," McGrady said. "I thought the rest would eventually come together."
McGrady struggled in the first half, shooting just 1-for-9.
"I just felt good in the second half," McGrady said. "I got my shot back. After you hit two or three shots in a row, you just kind of feel it. Once you get that feeling, you're in a zone. I don't care what defense they throw at you. It helped that I had others knocking down shots. It just opened things up for me."
Reserve guard David Wesley had 15 points before fouling out for Houston (2-3), which snapped a three-game losing streak. McGrady, making his return after missing three games with back spasms, also grabbed 10 rebounds.
Jason Kidd had a season-high 20 points and nine rebounds and Richard Jefferson added 17 points to lead the Nets (3-4), who lost for the third time in four games. New Jersey shot just 39.7 percent (29-for-73) from the floor, failing to reach 50 percent for the seventh straight game.
"It's hard to win games when a team shoots 62 percent from three and you shoot 37 percent overall," Nets coach Lawrence Frank said.
Yao scored 10 points in the first eight minutes of the game to help the Rockets take the lead for good. His dunk on a fast break tied the game for the final time at 13-13, and his free throw 15 seconds later gave Houston a one-point lead.
Yao keyed an 11-2 run that gave the Rockets a 22-15 lead with 2:44 left in the first period.
Houston led by as many as 14 in the second quarter, thanks to two 3-pointers from rookie guard Luther Head. Although McGrady struggled in the first half, Yao had 12 points and Head nine to help the Rockets take a 48-36 lead at the break.
McGrady made his first three shots in the third quarter, helping the Rockets to push the lead to 54-37 with 9:29 left in the period. The Nets crawled their way back into the sloppily played game, with Kidd hitting two 3s and Carter making one.
Jefferson made two free throws with 16 seconds remaining in the third, capping a 15-7 run to close the period and pull the Nets within 70-64.
On New Jersey's first possession of the fourth, McInnis hit a long 3 to beat the 24-second shot clock buzzer, cutting the deficit in half.
However, McGrady scored four straight points on a free throw and a long 3 from 25 feet, pushing Houston's lead to 74-67. McGrady then sealed the game with two 3s in a span of 45 seconds, giving the Rockets an 85-75 lead with 6:06 left.
"More than anything, he just got comfortable," Jefferson said. "He struggled through the first half and didn't get into the flow. But once he gets hot, he's among the best. He's very tough to stop."
Nets forward Jason Collins strained a lower leg muscle during a collision with Houston's Rafer Alston early in the third quarter. ... Wesley missed his first three 3-point attempts, dropping him to just 5-for-21 on the season at that point. However, he made his next three attempts. ... The Nets' best shooting night was 49 percent against Utah on Nov. 9. ... New York Yankees stars Jorge Posada and Bernie Williams were in attendance but in two different sections of the Continental Airlines Arena.