Miami overcame an early 15-point deficit in a dramatic contest that pushed the Heat to a 2-0 lead in the Eastern Conference finals.
Boston will host the third and fourth games of the series Friday and Sunday.
After rallying from its first-half deficit, Miami took a seven-point lead with 7 minutes to play. Boston then came back and had a five-point advantage with 3 minutes left before wilting down the stretch.
Miami had the last shot of the fourth period, but a 20-foot jumper by LeBron James to win it bounced off the back of the rim.
Boston moved in front at 105-103 with 2 minutes to go in the extra period on a pair of free throws by Rajon Rondo, but the Heat ran off the next nine points to take command.
James tipped in a shot to tie it with and, after a miss by Rondo, Haslem scored the last of his 13 points to give Miami the lead for good.
Miami then forced a turnover that led to a jumper by Dwyane Wade with 59 seconds remaining. Wade was fouled on the play by Kevin Garnett and the resulting free throw gave the Heat a 110-105 advantage.
Two more free throws by Wade with 18 seconds left completed the run and all but wrapped up the game.
James made 18-of-24 free throw attempts and scored 34 points to lead the Heat. Wade had 23 points and Mario Chalmers added 22.
Miami overcame a 44-point effort from Rondo, who hit 16-of-24 shots from the field. Paul Pierce had 21 points before fouling out in the fourth quarter and Garnett contributed 18.