MIAMI – LeBron James, Chris Bosh and Dwyane Wade had not played together in a couple of weeks, so the Miami Heat needed some time to get back into rhythm.

About 12 minutes, to be precise.

The Heat scored 41 points in the second quarter — their highest-scoring period of the season — to erase what was an early 13-point deficit and went on to beat the Boston Celtics 109-101 on Friday night.

“Felt good to get back in the lineup with the other ‘Big Two,’” James said. “It’s great. We’re just trying to get some more continuity, get our legs up under us.”

James had 20 points and nine assists in 29 minutes, and Rashard Lewis added 19 to lead a huge night for the Miami bench, which outscored Boston’s reserves, 52-14.

Bosh and Ray Allen each scored 17 for Miami, which got 12 from Norris Cole.

Wade, back after missing six games with bone bruises around his right kneecap, scored 11 points in 34 minutes for Miami, which won its 35th home game to tie the standard set in 2004-05. That was one of the two single-season marks for Miami on the evening — the Heat also made 12 3-pointers to push their total for the year to 686, topping the mark of 678 in the 1996-97 campaign.

Miami has already clinched home-court advantage for the entirety of the playoffs.

Jeff Green scored 25 for Boston, which played without Paul Pierce and Kevin Garnett, both out with ankle soreness. Coach Doc Rivers expects both Pierce and Garnett to play Saturday night at Orlando.

“Orlando is a team that, obviously, you see them. I don’t want to give them any fuel but they’re terrible,” Celtics guard Jason Terry said.

“So we must go in there with whoever we have and scrap for the win.”

Jordan Crawford added 20, Courtney Lee scored 18 and Brandon Bass had 17 for Boston.

The Celtics need one more win to wrap up the No. 7 spot in the East, which would lock Milwaukee into the No. 8 seed and a first-round matchup with Miami.

“I thought their subs beat our subs if you want to just simplify it,” Rivers said.

Boston lost 3 of 4 to the Heat this season, and if the teams are to meet in the playoffs for a fourth consecutive season, it would now almost certainly have to be in the Eastern finals. The Celtics lost in seven games to Miami in that round a year ago.

The Celtics came out flying early, running out to a 10-point lead after the opening quarter and extending that lead to 30-17 when Lee opened the second with a 3-pointer.

After that it was largely all Miami.

The Heat shot 16 of 19 from the field in the second quarter — their best shooting in any quarter since 2007, and the NBA’s third-best, single-quarter effort this season — on the way to turning around the game. Miami’s bench shot 8 of 9 in the quarter, scoring 22 points, one less than Boston’s entire roster in the period.

Miami held massive edges in both rebounding (9-2) and assists (12-3) in the quarter, and when Wade beat the buzzer with a layup, Miami went into the break with a 58-50 lead.

“I’ve still got some work to do,” said Wade, who appeared to bang his knee against the basket support Friday but said he was feeling fine.