A dash to a long-shot playoff berth became a marathon for the Nets Friday night as they staggered, then stampeded, then stepped ahead of the Bucks, beating Milwaukee, 129-127, in a triple-overtime thriller at Barclays Center.

The Nets, who trailed by as many as 14 in the third quarter, were given life again and again by Joe Johnson, who hit a three-pointer with 1:19 left in regulation to tie the score at 101, sank another with 18 seconds left in the second overtime to tie it at 117 and hit two free throws with eight seconds left in the third OT for a 129-125 lead. That proved important when Khris Middleton hit a layup in the final seconds to account for the final margin.

Brook Lopez had 32 points and 18 rebounds. Thaddeus Young scored 24, followed by Johnson (20) and Bojan Bogdanovic (17). Alan Anderson and Jarrett Jack had 13 and 12, respectively.

Middleton had 29 points, eight rebounds and six assists in a game-high 55 minutes. Giannis Antetokounmpo added 23 points and 14 rebounds and Zaza Pachulia had 22 points and 21 rebounds.

"We just didn't give up," Jack said. "We played like a desperate basketball team . . . and we have one of these [games] in less than 24 hours. We have to do this again."

It was no secret that Friday night's win over the Bucks and the four games to follow are pivotal to the Nets' fading playoff hopes. It was fitting, then, that the frenzied final minutes of regulation and overtime became so mercurial.

advertisement | advertise on newsday

Mostly punchless and unable to maneuver around the Bucks' size advantage, the Nets (28-39) turned it around in a spirited fourth-quarter display. But despite having momentum on their side after taking a 98-94 lead with 4:08 left, they allowed the Bucks (34-35) to score five straight, highlighted by Ersan Ilyasova's three-pointer with three minutes left (good for the lead) and Pachulia's tip with 2:22 to go for a 101-98 advantage.

That set the stage for Johnson's three-pointer.

"I just wanted to be aggressive and make plays," he said. "They were double-teaming me, so I was trying to make them pay . . . We were getting wide-open shots."

Added coach Lionel Hollins: "I thought that if anybody can get a quick shot off, it would be Joe."

Though the Bucks, led by former Nets coach Jason Kidd, came in on a four-game losing streak, the Nets' comeback was a turn of events few saw coming.

Brooklyn Nets videos

"This was an amazing game," Hollins said. "It looked like we were dead in the water for a minute, and all of a sudden, we come back . . . I am just thrilled we got the win."

No matter how long it took.