"Jim and Jenny have recently decided to end their five-year relationship," Carrey's rep Marleah Leslie tells PEOPLE.
The two had supported each other through many life events, including the birth of Carrey's first grandchild after the actor's daughter, Jane, gave birth to a son in February.
"I'm so grateful for the years Jim and I shared together," McCarthy, 37, said in a statement. "I will continue to be in his daughter's life and will always keep Jim as a leading man in my heart."
In announcing the split on his Twitter page, Carrey, 48, echoed her warm sentiments. "I'm grateful 4 the many blessings we've shared and I wish her the very best! S'okay!" Carrey Tweeted.
Still, the breakup came as a surprise as the pair had always appeared to be among Hollywood's happiest and most devoted couples.
In February, the two were the picture of happiness publicly. "Jenny is the first person that I’ve been with where I don't have a giant question mark over my head," Carrey told PEOPLE at an event they hosted to support McCarthy's autism organization, Generation Rescue, in Miami. He also discussed their upcoming plans for Valentine's Day, telling PEOPLE, that "everyday is Valentine's Day" with McCarthy.
Over the years, Carrey has also grown close to McCarthy's son, Evan, who has Autism. "He taught me how to love," Carrey said in 2008 at a march in Washington, D.C. "And without Evan I might never have seen the greatness of Jenny's spirit."
For her part, McCarthy has praised her then-boyfriend's devotion to Evan telling PEOPLE, "[He has the] capacity to love and to take on something that most men would completely run away from."
As for McCarthy herself, as early as 2007 Carrey said their romance was the real deal. "We also encourage each other," he said. "We're both on the same path, so it's really real."
Additional reporting by OLIVER JONES and JULIE JORDAN