DAVID DUCHOVNY’s wild “CALIFORNICATION” nights over as he reunites with wife TEA LEONI!

After splitting twice, “The X Files” hunk David Duchovny and estranged wife Téa Leoni are getting back together – again!

Sources tell The National ENQUIRER that the two are working hard to mend their shattered marriage – and they recently shared a romantic beach day in Malibu. “David and Téa have talked about divorce forever, but they never got around to filing papers,” said a friend.

“Now they’re enjoying each other’s company so much that they’ve abandoned the idea of divorce, and their kids couldn’t be happier.”

The couple wed in May 1997, and the “Deep Impact” actress gave birth to their daughter, Madelaine, in April 1999. Their son, Kyd, was born in June 2002.

But their happiness was shattered in August 2008 when David announced that he’d checked himself into a rehab facility for sex addiction.

At the time, the couple said they had already been separated for months.

David, 53, and Téa, 48, managed to iron out their differences, but split up again in 2011. A year later the actor announced they were still married, but separated.

But recently the two have shared intimate dinners and lots of one-on-one time, revealed the source. “The sex addiction period was really difficult,” added the friend. “Most other Hollywood couples would have called it a day and brought in the divorce lawyers, but not David and Téa.

“They want to make it work.”

David recently wrapped up the Showtime series “Californication” after seven seasons, and is now filming the NBC cop drama “Aquarius” where he hunts Charles Manson.

Meanwhile, Téa plays the U.S. Secretary of State in the upcoming CBS drama series, “Madam Secretary.” The source added: “The kids still hold out hope their parents will get back together and start living in the same house again.

“In the meantime, everyone seems happy.”