Dallas has energized its season by winning four in a row and giving itself hope of reaching the playoffs after a struggling first half of the season.
The Mavericks led by 11 near the midway point of the final period, but Houston tied it with 1:52 to play.
Dallas then went on an 8-1 run with all eight points coming from the line -- two by Mayo, two by Dirk Nowitzki and two by Dahntay Jones. Those foul shots were coming while Houston was suffering from two missed field goal attempts and one turnover.
The Rockets have lost five in a row.
Nowitzki led the Mavericks with 19 points while both Mayo and Shawn Marion had 18. Dallas attempted 43 free throws and made 34 of them.
James Harden scored 20 points for the Rockets, but connected on just only 5-of-23 from the field.