Pau Gasol blocked Ray Allen's putback attempt at the buzzer in overtime and the Los Angeles Lakers held on to beat the Boston Celtics 88-87 on Thursday night.

Kobe Bryant had 27 points, Gasol finished with 25 points and 14 rebounds, and Andrew Bynum added 16 points and 17 rebounds to help the Lakers snap a two-game losing streak.

Allen scored 22 points and Kevin Garnett had 12 points and 12 rebounds for Boston, which had won five in a row and nine of its previous 10 games. But Garnett was 6 for 23 from the field and Paul Pierce was 7 for 18, including a clean-look jumper at the end of overtime.

It rimmed out and Allen tried to push the rebound in, but Gasol got his fingertips on it and it floated away as the buzzer sounded.

The Lakers had lost six of their last seven games on the road.

But a trip to Boston to play the rival Celtics was just what they needed.

Both teams shot under 40 percent, and they each missed twice to start the overtime before Bryant sank a jumper that gave the Lakers an 84-82 lead with 3:30 left. Allen missed, then Steve Blake made a jumper to give the Lakers a four-point lead — their biggest of the game.

Pierce made a jumper and, after Gasol missed, Pierce hit a 3-pointer over Metta World Peace to make it 87-86 Boston. Bryant missed, but Bynum tipped it in with 1:30 left to give L.A. the lead, and it held up.

Pierce finished with 18 points, nine rebounds and seven assists.

Bynum converted a three-point play to give the Lakers an 80-79 lead with 2:39 left in regulation, and it stayed that way through several trips down the floor before the Celtics called timeout with 1:16 left. After the inbounds pass, Allen made a catch-and-shoot 3-pointer to put Boston into the lead.

World Peace, who hit the NBA title-clinching basket for the Lakers against Boston in 2010 back when he was known as Ron Artest, missed a 3. Garnett grabbed the rebound and the "Beat L.A.!" chants began in the TD Garden.

But Garnett missed a jumper and Gasol tipped in Bryant's miss to tie it 82-all. The Celtics had a chance to win it in regulation, but Pierce got trapped near midcourt and Pietrus was forced to fire up a no-chance 30-footer at the buzzer.

The Celtics led by nine points in the first quarter, but the Lakers erased the deficit in the second and briefly took a one-point lead at 38-37. Boston led 64-59 when Gasol converted a three-point play and Bryant made back-to-back jumpers to give Los Angeles a 66-64 lead.

Notes: Pierce was the only Celtic selected to the All-Star roster when the reserves were announced Thursday. ... Boston's Marquis Daniels played for the first time in four games because Sasha Pavlovic had a flare-up in a left wrist injury that he sustained in training camp. ... Bynum had nine points and nine rebounds in the first half. ... The AFC champion New England Patriots were well represented: Vince Wilfork, Rob Gronkowski and owner Robert Kraft were all at the game, fresh off Sunday's Super Bowl loss to the New York Giants. ... The teams meet again in Los Angeles on March 11. ... Garnett took a season-high 23 shots. ... Bryant made his first four shots and then missed seven of his next 10.