CLEVELAND — Imagine being down by 13 points and losing the best player in the world to his fourth foul before the second quarter of Game 4 in the Eastern Conference finals is even over.

And then handing the ball to Kyrie Irving, getting out of the way, and watching him bring the team to the doorstep of the NBA Finals.

That was reality for the Cavaliers on Tuesday night, as Irving set a playoff-career high with 42 points in Cleveland’s 112-99 win over the Boston Celtics.

The Cavs, ahead 3-1 in the series, can reach their third straight NBA Finals, and LeBron James his seventh in a row, with a win in Game 5 on Thursday night in Boston.

James scored 34 points to go with six assists in Game 4, even though he left the game with 6:46 remaining in the second quarter after picking up his fourth foul. He never previously had that many fouls in the first half in his 14-year career, and Cleveland trailed 46-33.

Irving scored 36 points after that, including 21 during a game-turning third quarter in which Cleveland outscored the Celtics 40-23.

“In the back of my mind, I was like, I’m saying to myself, ‘We cannot — they cannot tie up this series,’” Irving said. “They cannot. We cannot go to Boston 2-2 and then it becomes almost an even series.”

Kevin Love added 17 points and a career playoff-high 17 rebounds for Cleveland. The 93 points produced together by Irving, James and Love are the most they have amassed as a group and the second highest for a trio in team playoff history.

Avery Bradley led the Celtics with 19 points, and Jae Crowder added 18 points and eight rebounds. Al Horford contributed 16 points and seven assists.

The Celtics, who are missing their best player, injured guard Isaiah Thomas, led by as many as 16 points in the first half and appeared primed to stun Cleveland again while James flirted with trouble.

Irving kept the game close until halftime with 12 points. Then he tied a team playoff record with his 21 points in the third, set a Cavs postseason record with nine field goals and scored the final 14 points of the period.

When his 3-pointer splashed with a half-second left in the third quarter, the Cavs led 87-80. The circumstances were different and the primary author of the comeback was Irving instead of James, but Cleveland fighting back from 16 down was in some ways reminiscent of the 26-point halftime deficit the Cavs erased in Game 3 of their first-round series against the Indiana Pacers.

“I’m telling my guys on the court the whole entire game, we’ve seen this before, we’ve been through this, we’ve experienced this, and we’re going to get through this, and from that point on, it clicked,” Irving said.

Irving also rolled an ankle on a drive and bucket with 1:47 left in the third but was able to stay in the game.

James recovered from an 11-point, 4-of-13 shooting night he endured in Cleveland’s stunning Game 3 loss. He shot 15 of 27 from the field Tuesday and closed the game with 15 points in the fourth, including a 3-pointer with 3:52 remaining for a 106-97 lead.

“I don’t think I’ve ever had four fouls in a game before in the first half, so my rhythm is kind of broken and you’ve got to figure out ways you can still help the team, and my teammates said be aggressive, be you,” James said. “You got us to this point and continue to do that, so I just tried to find ways to get into the lane, get into transition, when they backed off, shoot the jumper, and felt very comfortable.”

The Celtics proved to be a tough cover without Thomas again in the first half, bringing to mind their second-half success in their 111-108 win in Game 3. However, they committed nine turnovers that led to 13 Cleveland points in the second half.

Bradley shot just 7 of 19 from the field. Crowder started the game 4 of 5 but finished 6 of 12. He also sustained a strained left thigh in the third quarter but returned to the game.

The Cavs had nine turnovers for 13 points in the first half. In the second half, they shot 27 of 38 (71.1 percent) from the field.

“Kyrie Irving and LeBron James would be the two answers,” Celtics coach Brad Stevens said when asked about the difference from the first half to the second. “They were unbelievable. Irving was incredible at the end of the third, and then obviously LeBron had all those baskets in the fourth.

“I thought that we played, you know, as well as we’ve played maybe the entire playoffs in the first half. We were really good defensively. Offensively, I thought we moved and cut and played together, and then for whatever reason, all those things became a little bit more difficult. But that’s what great teams do. They make it really hard on you.

“As we all know, a 10-point lead at halftime is nothing, especially against those guys. But they deserve a lot of credit. Those two guys were incredible.”

NOTES: Celtics G Isaiah Thomas (right hip) visited with an undisclosed specialist to determine the course of action for his surgery. Coach Brad Stevens said no decision had been made yet on whether Thomas would undergo an operation but reiterated that the guard is out for the remainder of the playoffs. Stevens said Thomas may consult with two additional specialists. … Boston F Kelly Olynyk made his first start of the postseason in place of Amir Johnson (sprained shoulder), and he scored 15 points. The Celtics used their third different starting lineup in four games against Cleveland. … Cavs G J.R. Smith and his wife brought home from the hospital their baby daughter Dakota, who had been in a Cleveland-area NICU since her birth in January. She was born nearly five months early. … Cavs F LeBron James trails Michael Jordan (5,987 points) by just 28 points for first place in NBA playoff history in scoring.