The Los Angeles coroner's office said Haim died at 2:15 a.m. at Providence St. Joseph Medical Center in Burbank.
According to the LAPD, Haim had been staying with his mother in an apartment in Universal City for about a year, and the death appears to have been caused by an accidental overdose.
Neighbors who live in the apartment complex say when the paramedics arrived early Wednesday morning they worked on Haim for 30 minutes before they rushed him to the hospital.
"They wheeled him out with an oxygen mask on, but no one was working on him at that time," said Jim Canessa, Haim's neighbor. "So I thought possibly it wasn't totally serious."
"Corey woke up at about 1:30 a.m. and was a little dizzy. He went to his knees in the bedroom and his mom assisted him into bed. He became unresponsive at around 1:30 a.m.," said Assistant Chief Coroner Ed Winter. "She called paramedics and he was transported to the hospital where he was pronounced at 2:15 a.m. We found no illicit drugs, however, we did recover four of his prescription meds at the location."
Corey Feldman says his long-time friend was in the best frame of mind ever in the days leading up to his death.
"I had just been getting him out more recently. I had taken him up to the Playboy Mansion for the Super Bowl party," Feldman said on CNN's Larry King Live.
An official cause of death has not yet been determined, but the LAPD said Haim appears to have died of an apparent overdose.
Feldman says people shouldn't jump to any conclusions.
"Until the Coroner's report comes out, until we have specific evidence and until we know what the toxicology report says nobody knows," said Feldman.
Haim had flulike symptoms before he died and was getting over-the-counter and prescription medications, Police Sgt. William Mann said.
"He could have succumbed to whatever (illness) he had or it could have been drugs. Who knows?" Mann said. "He has had a drug problem in the past."
Haim acknowledged his struggle with drug abuse to The Sun in 2004.
"I was working on 'Lost Boys' when I smoked my first joint," he told the British tabloid. "I did cocaine for about a year and a half, then it led to crack."
Haim said he went into rehabilitation and was put on prescription drugs. He took both stimulants and sedatives such as Valium.
"I started on the downers which were a hell of a lot better than the uppers because I was a nervous wreck," he said. "But one led to two, two led to four, four led to eight, until at the end it was about 85 a day."
In 2007, he told ABC's "Nightline" that drugs hurt his career.
"I feel like with myself I ruined myself to the point where I wasn't functional enough to work for anybody, even myself. I wasn't working," he said.
"I am a good friend of Corey Feldman's. I have had a few run-ins with Corey Haim here. Most of the people did when he was going through his little stages and stuff," said Christopher Ameruoso, an acquaintance of Haim's. "I guess he was on a road to recovery, but last night just wasn't a good night."
Haim broke into the film industry in 1984 as a child actor. He starred in movies such as "Lucas" with Charlie Sheen, but his breakthrough role came with his 1987 film "Lost Boys."
In recent years, he appeared in the A&E reality TV show "The Two Coreys" with his friend Corey Feldman.
Feldman released the following statement:
"I was awakened at 8:30 this morning by my brother and sister knocking on my bedroom door. They informed me of the loss of my brother Corey Haim. My eyes weren't even open all the way when the tears started streaming down my face. I am so sorry for Corey, his mother Judy, his family, my family, all of our fans, and of course my son who I will have to find a way to explain this to when he gets home from school. This is a tragic loss of a wonderful, beautiful, tormented soul, who will always be my brother, family, and best friend. We must all take this as a lesson in how we treat the people we share this world with while they are still here to make a difference. Please respect our families as we struggle and grieve through this difficult time. I hope the art Corey has left behind will be remembered as the passion of that for which he truly lived."
Haim had long fallen from Hollywood's A-list and was trying to make a comeback. He starred in the low budget thriller "American Sunset," which is slated to be released later this year.
He also just finished shooting a movie called, "Decisions."
"He was a gentleman and he was a professional," said producer Zenon Kesik. "There was no sign of substance abuse."
Friends and neighbors say that Haim shared acting advice with some of the young actors that lived in the apartment complex.
One neighbor said that Haim always looked young and healthy, but that he was under a lot of stress taking care of his mother who has been ill.
"First she had cancer which was hard on him," said Eric Jay. "He loved his mom and they were very close. They are in my prayers."
The Associated Press contributed to this story.