EXCLUSIVE

Mac Miller was dead for many hours before his body was discovered in his bedroom and 911 was called, TMZ has learned, and there's now a spotlight on the party at Mac's home the night before.

Law enforcement sources tell us ... when cops and paramedics arrived at the rapper's home last Friday, it was clear he had died long before they got there.

TMZ broke the story ... friends came over the night before Mac died to hang out, and we're told they stayed until the early hours of Friday morning, Sept. 7. Mac's body was found Friday around noon.

We broke the story ... Miller died of an apparent overdose at his San Fernando Valley home. Cops say no one has come forward claiming they saw Mac alive after Thursday night.

He was pronounced dead at the scene, after someone at his home called 911, saying Mac wasn't breathing and was unresponsive. The emergency dispatch call came in as "cardiac arrest," but apparently that's because the person who found him may not have realized he was already dead.

Our sources say only a tiny amount of white powder was found when cops searched the home. Our law enforcement sources tell us cops believe the house was swept clean to hide evidence of drug use.