BOSTON -- For Kevin Garnett, returning from an injury is all about getting back the rhythm he has developed with his Boston teammates.

"It's like being at a party, and the record skips, and you've got to get back on beat," he said after helping the Celtics erase an eight-point, fourth-quarter deficit and beat the Detroit Pistons 86-82 on Wednesday night. "So, you know, the record skipped a bit. But I'm at the party; I've just got to find that groove again.

"For y'all who can't dance, don't take it personally."

Paul Pierce scored 22 points and Ray Allen hit a jumper with 25 seconds left to give the Celtics their first lead of the second half. Shaquille O'Neal had 12 points and 12 rebounds, and Garnett added 11 points and six boards in his second game back after missing nine with a leg injury.

Allen finished with a season-low seven points on 2-for-8 shooting, missing all four of his 3-point attempts. But the Celtics called a play for him out of a timeout and he caught the pass off a screen, turned and (with his foot on the 3-point line) hit the open jumper.

"I wasn't shooting the ball particularly well," said Allen, who needs 28 more 3-pointers to tie Reggie Miller atop the NBA's career list. "I didn't really think I had a great rhythm. But I always feel like the next shot is going to go in, so I was never worried about it."

It was the fourth straight victory for the Celtics.

Rodney Stuckey scored 15 points and Greg Monroe had 13 points and nine rebounds for the Pistons, who led by eight with 8 minutes left but did not score over the game's last 2:43.

"We competed with the best team in the East, and one of the better teams in this league, on their home court," Pistons guard Tracy McGrady said. "If we can give this type of effort night-in and night-out, we're going to give ourselves a chance. We just have to learn how to close out games and to execute down the stretch."

The Pistons had won three in a row after coach John Kuester shook up his lineup, benching Richard Hamilton and inserting Monroe at center and McGrady at point guard. It was the longest winning streak of the season for Detroit, which opened with an 11-26 record.

The Pistons led by eight on Ben Gordon's 3-pointer, but the Celtics made three straight baskets before Chris Wilcox hit one free throw to make it 76-73 with 5:23 left. Rajon Rondo took a jumper near the top of the key, and O'Neal tipped the rebound off the backboard before grabbing it and laying it in; McGrady swiped at him, and the free throw made it 76-all.

It was a two-point game with 3:02 left when O'Neal missed two free throws, and Detroit made it 82-78 on Monroe's reverse layup. But Garnett scored inside, and then Pierce made a jumper in the lane.

After McGrady missed, Garnett missed a long jumper but Rondo got the rebound and called timeout. The Celtics ran Allen off a screen to get him open near the 3-point line on the right side and he sank the basket; it was initially ruled a 3-pointer, but replays showed his right foot was on the line, making the score 84-82.

Stuckey missed a leaner in the lane, and Garnett grabbed the rebound, then hit one of two foul shots. Gordon drove and missed a layup over Glen "Big Baby" Davis' outstretched arms.