CLEVELAND — Kyrie Irving took over in the second half and finished with 42 points, LeBron James added 34 and the Cleveland Cavaliers moved within one win of an almost inevitable third date in the Finals with Golden State by rallying to beat the Boston Celtics 112-99 on Tuesday night in Game 4 of the Eastern Conference finals.

Irving stayed on the floor despite rolling his left ankle in the third quarter, when he scored 19 in less than five minutes, and James shook off early foul trouble as the Cavs opened a 3-1 lead in the series.

The defending NBA champions can wrap up their third straight conference title — and a “three-match” against the Warriors — with a win in Game 5 on Thursday night in Boston.

But if Games 3 and 4 are any indication, it won’t be easy.

Fighting to keep their season alive, the Celtics aren’t giving an inch despite playing without All-Star guard Isaiah Thomas, who may need surgery on a hip injury.

The Cavs, meanwhile, wouldn’t be on the cusp of the Finals without Irving.

advertisement | advertise on newsday

With Cleveland in jeopardy of dropping its second game in a row after James followed an 11-point Game 3 by picking up four first-half fouls, Irving put on a breathtaking one-man show in the third quarter.

Freezing Boston defenders with his dribble and driving to the basket whenever he wanted, Irving made six layups, two 3-pointers and a free throw in a dizzying span of 4:48. He capped his blistering 19-point outburst with a 3 in the final second of the quarter and celebrated at mid-court by pretending to put two pistols back in his holster.

When the horn sounded, Cleveland’s players poured off the bench to greet him. They had to be careful not to knock him off his feet after Irving had put a scare through the frenzied Quicken Loans Arena crowd moments earlier when he stepped on the foot of Boston’s Terry Rozier.

Irving stayed on the floor for several seconds before sitting up and re-tying his left sneaker.

Nothing was keeping him out.

NBA videos

Kevin Love added 17 points and 17 rebounds for the Cavs, now 11-1 in the postseason.

Avery Bradley scored 19 and Jae Crowder 18 for Boston.

Cavs coach Tyronn Lue chuckled before the game when he was asked if he planned to say anything to James following his sub-standard performance in Game 3.

“No message,” Lue said. “Just come out, be aggressive, in attack mode like he has been over the last four or five months. Nothing has changed.”

Lue should have warned James to be careful, too, as the superstar picked up four fouls and spent the final 6:46 watching from the bench, unable to help his team.

advertisement | advertise on newsday

But beyond James’ foul trouble, the Cavs were having other issues as the Celtics outplayed them at both ends while opening a 16-point lead.

Irving kept Cleveland within striking distance while James was out by scoring 12 points over the final 5:11 of the second quarter.

And in the third quarter, the All-Star guard had James’ back again, keeping the Cavs on their collision course with the Warriors.