Lin and James Harden combined to score the last 18 points for the Rockets, who erased an 11-point fourth-quarter deficit and got even at 97. After Elton Brand blocked a layup attempt by Harden, Mayo hit both free throws after getting fouled on a layup at the other end.
|More on Rockets-Mavericks|
|More NBA coverage|
Lin had a chance to tie the score on free throws, but missed the second of two. The Rockets got one more chance to go in front, but Harden couldn't get a good look at a layup. Nowitzki won a scramble for the ball and hit two free throws for a 101-98 lead.
Dallas won its season-best fourth straight game, and the Rockets lost their fifth in a row, also a season high.
Harden led the Rockets with 20 points but made just 5 of 23 from the field. Lin had 19 with some critical misses among his 6-of-10 shooting on free throws.
Mayo and Shawn Marion had 18 apiece for Dallas. Nowitzki had 10 points in the fourth quarter.
Omer Asik had 12 points and 15 rebounds for Houston.
The Mavericks led 93-82 midway through the fourth when Lin scored on two driving layups and a 3-pointer, and Harden hit four free throws. The Rockets were down one and Lin had chance to give them a lead, but he missed the first of two free throws and tied the score.
Harden had gone more than two quarters without a basket when he stole a pass and converted a three-point play on the other end midway through the third. He ended up with five points during a 10-2 run that pulled Houston to 71-69, but missed an easy layup that would have made it a one-point game.
Dallas went more than five minutes between baskets in the third quarter, but Nowitzki ended the drought with a 3-pointer from the corner with 8.1 seconds left to give the Mavericks an 80-73 lead entering the fourth.
The Mavericks went on a 19-0 first-quarter run that included Harden picking up his second foul on a three-point play by Mayo. The Rockets committed nine turnovers and missed six shots before Toney Douglas ended the Dallas spurt with a 3-pointer. Darren Collison had seven points, including a 3, during the run.
Guarded closely by Marion and Dahntay Jones, Harden missed eight straight shots to finish the first half after a dunk that put Houston ahead 15-10. Even without Harden scoring, the Rockets stayed close.
Houston's Carlos Delfino committed four turnovers in the first four minutes after entering the game midway through the first quarter, but later had a nice steal when he poked the ball away from Mayo near midcourt for a layup during a 15-6 run that pulled Houston to 45-39 late in the second.
Patrick Beverley, who had played just two minutes for Houston after coming up from the NBA Development League on Monday, had five points, two assists and a block on Mayo in the lane during the run.
At one point late in the first half, the Rockets had more turnovers (11) than baskets (nine) and were shooting less than 30 percent before hitting five straight shots.
Houston finished the half at 36 percent, but Dallas wasn't much better at 38. Nowitzki was 2 of 8 with four points and just two rebounds before halftime.
The Mavericks didn't trail in Monday's 113-98 win over Minnesota, the first time this season Dallas led from start to finish. It was also the first time the Mavericks had three players with 20 or more points in a game. Darren Collison had 23 and O.J. Mayo and Elton Brand scored 20 apiece. ... Collison and Mayo had nine assists each against the Timberwolves, making it the first time since 2002 that two Dallas players had at least 20 points and nine assists in the same game. ... Houston's 18 points in the first quarter matched a season low for a Dallas opponent in the first. ... Mavericks G Mike James' 10-day contract expires at midnight Thursday. It wasn't clear whether the Mavericks planned to keep him.