LeBron James scored 29 points and Dwyane Wade added 28 for the Heat, with Chris Bosh scoring 16 and Allen finishing with 13. James made one of two free throws with 9.5 seconds left to put the Heat up by two, and the Nets almost failed to get a potentially game-tying shot off after Paul Pierce lost it out of bounds, but it stayed with Brooklyn after replay.
And the Nets still couldn't get a shot away: Allen knocked it away from Joe Johnson as he made his move, and time expired.
Johnson had 34 points, Pierce scored 19 and Deron Williams had 17 for the Nets.
It's the sixth trip to the East title series in the last 10 seasons for Miami, which is bidding for a fourth straight trip to the NBA Finals something only the Lakers and Celtics franchises have accomplished.
James is heading there for the sixth time in eight seasons, the first two of those trips coming with Cleveland in 2007 and 2009.
The Heat will next face either fifth-seeded Washington or top-seeded Indiana. The Pacers lead that series 3-2, one win away from setting up a rematch with Miami that seemed like an absolute certainty for much of the season.
The tone for this one was set early, Brooklyn running out to an 11-4 lead before the game was three minutes old, clearly and predictably the more desperate team from the outset. The Heat weathered the early storm and when James Jones connected on a 3-pointer with 3:02 left in the half, Miami held a 42-41 lead that was significant for two reasons.
One, it was Miami's only make on 16 attempts from 3-point range in the half.
Two, it was the last time Miami scored before intermission. Brooklyn finished on an 8-0 run and took a 49-42 lead into the break. The lone bright spot in the opening 24 minutes for Miami was Wade, who had 20 points more than any other two players to that point combined on 7-for-12 shooting.
Miami scored the first seven points of the second half, tying the game, before Brooklyn immediately answered with seven straight points of its own. The Nets extended the lead to 61-51 midway through the third on a 3-pointer by Williams, and whenever Miami tried to put together a run Brooklyn found a way to keep things together.
A layup from James late in the third got the Heat within three; a minute later, the margin was eight again.
A free throw from James with 9:03 left cut Brooklyn's lead to 77-73; less than a minute later, it was 82-73 after a 3-pointer by Pierce.
A 3-pointer by Bosh made it a four-point game again; two Brooklyn possessions and zero Miami stops later, it was 86-78 after a sensational step-back jumper by Johnson.
The Nets' sharpshooter was the story. Even with James draping Johnson, the Brooklyn guard got a three-point play to put the Nets up 89-80 with less than 6 minutes left. Another fadeaway on the next possession, with the shot clock running down, was pure by Johnson again, and the Nets could sense that the night would be theirs.
Then the Heat scored the next 12 points, and that was enough. Barely, but enough.
NOTES: Brooklyn's Mirza Teletovic leaped over the Miami bench and into the stands, taking a hard tumble with 3:42 left. He was uninjured after the scary-looking spill. ... Wade had 12 points in the first quarter, his highest-scoring output from an opening period in his last 179 regular-season and playoff games. ... Both of Johnson's 30-point games in these playoffs have been on the road. He had 32 at Toronto on April 30.
Heat 96, Nets 94
Brooklyn 22 27 26 19 94
Miami 23 19 24 30 96
Johnson 15-23 1-1 34, Pierce 8-18 1-2 19, Garnett 1-3 0-0 2, Williams 7-16 0-0 17, Livingston 2-6 4-4 8, Anderson 1-3 0-0 2, Blatche 0-0 0-0 0, Teletovic 1-3 4-4 6, Kirilenko 1-2 2-4 4, Thornton 1-4 0-0 2.
Totals 37-78 12-15 94.
James 6-14 15-17 29, Bosh 6-11 0-0 16, Chalmers 0-5 2-2 2, Wade 10-18 8-8 28, Allen 4-10 4-4 13, Andersen 0-1 0-0 0, Jones 1-2 0-0 3, Cole 0-3 0-0 0, Lewis 2-3 0-0 5.
Totals 29-67 29-31 96.
3-Point GoalsBrooklyn 8-22 (Johnson 3-6, Williams 3-7, Pierce 2-5, Anderson 0-1, Thornton 0-1, Teletovic 0-2), Miami 9-29 (Bosh 4-6, James 2-5, Lewis 1-2, Jones 1-2, Allen 1-7, Cole 0-2, Chalmers 0-5). Fouled OutNone. ReboundsBrooklyn 47 (Garnett 8), Miami 37 (James 9). AssistsBrooklyn 14 (Williams 4), Miami 18 (Chalmers 7). Total FoulsBrooklyn 21, Miami 16. A19,615 (19,600).
• Miami 96,Brooklyn 94 Heat win series 4-1
• San Antonio 104, Portland 82
Spurs win series 4-1
• Indiana at Washington, 6 p.m., ESPN
Pacers lead series 3-2
• Oklahoma City at L.A. Clippers, 8:30 p.m., ESPN
Thunder lead series 3-2