Jennifer Lopez and Leah Remini are burying the hatchet!

The singer, 55, and the actress, 54, had been close pals for decades, but J. Lo’s reunion with Ben Affleck caused a huge rift between them.

“Jennifer wanted her friend’s support. However, Leah saw the writing on the wall and straight out told her marrying Ben was a bad idea,” an insider exclusively tells In Touch.

The pair completely stopped speaking, and the King of Queens alum was noticeably absent at the couple’s Georgia wedding. But a few months ago, Leah reached out upon hearing that J. Lo and Ben, 52, were having problems, reveals the insider.

Turns out, Leah and her husband, Angelo Pagan, weren’t doing so well, either. Shortly after J. Lo filed for divorce, Leah announced her split, too.

“Ironically, the timing couldn’t have been better,” notes the insider. “Now, they have each other to lean on.”