Paul Mooney -- the longtime comedian, writer and actor known best for his work with Richard Pryor -- has died from a heart attack ... TMZ has learned.
According to his family ... Mooney died Wednesday morning at his home in Oakland. We're told the paramedics tried unsuccessfully to revive him after he suffered a heart attack.
Paul, who's been out of the public eye for a few years, had also reportedly been suffering from dementia for some time and was staying with a family member.
Though born in Louisiana, Mooney moved to Oakland and grew up there, and got his start in entertainment as a circus ringmaster ... which led to a passion for telling and writing jokes.
This led to his first professional gig in show business as a writer for Pryor, and the 2 would maintain a working relationship for years to come ... with Paul contributing to Richard's legendary stand-up performances such as 'Live on the Sunset Strip.'
Mooney was also the head writer on "The Richard Pryor Show" and wrote a few episodes of "Pryor's Place." His other notable writing credits include "Sanford and Son," "In Living Color" and "Chappelle's Show."
As an actor, Paul's best known for playing Sam Cooke in the 1978 film, "The Buddy Holly Story," and for his role as Junebug in Spike Lee's "Bamboozled" ... along with regular appearances on "Chappelle's Show."