SARAH JESSICA PARKER and hubby Matthew Brod­erick’s troubled marriage is back on track, thanks to an unlikely angel — American pop artist John Wesley.

The 84-year-old painter dated Matthew’s mother, Patricia, for six years before she died in 2003. And while Matthew and John were never particularly close during Patricia’s life, they’ve bonded over their shared loss since her death.

A source tells The ENQUIRER that Matthew, 51, now sees John as a father figure and is grateful for the way he cared for Patricia at the end of her life. To show his appreciation, he and wife Sarah Jessica, 48, are helping to support John financially.

“Matthew and Sarah Jessica feel he’s an important addition to the family and a brilliant grandfather figure to their kids,” said the source.

“The children adore him and love helping him paint. John doesn’t have any family of his own, so he fits right into the Broderick clan. But it’s the perspective John has given the couple about what really matters in life that has helped heal their troubled union.”

The “WarGames” actor and his “Sex and the City” sweetheart began dating in 1993 and wed four years later. They have three kids together – James, 10, and 3-year-old twins Loretta and Tabitha.

IN 2008, it was reported that Matthew had cheated and their marriage was on the skids – but the source says John’s involvement in their lives has helped turn things around.

“Matthew’s fallen in love with Sarah Jessica all over again,” the source added. “This situation with John has brought home how important it is to have a loving and caring partner in life. He’s given them a new appreciation for the 20 years they’ve been together.”