Producer/rapper Timbaland attends the VH1 Hip Hop Honors: All Hail The Queens at David Geffen Hall on July 11, 2016 in New York City.

Producer/rapper Timbaland attends the VH1 Hip Hop Honors: All Hail The Queens at David Geffen Hall on July 11, 2016 in New York City.

*Timbaland has revealed that he developed an addiction to pain pills several years ago that derailed his marriage, nearly destroyed his career and brought him close to death.

“I was on drugs, dude,” the 45-year-old music producer shared with Rolling Stone. “I was on OxyContin.”

He started taking the powerful pain pills in his 30s to cope with nerve damage he suffered from a gunshot wound as a teenager. But things soon went off the rails — his marriage ended, he wasn’t working as much and the number of pills he was taking increased.

“Music is a gift and curse,” he said. “Once you’re not popping, it plays with your mind. The pills helped block out the noise — I’d just sleep all day.”

Timbaland recalls a time when his friend Jay-Z advised him to stop doing interviews because they were doing more harm than good. His girlfriend, Michelle, even became worried that Timbaland would not live much longer.

“It was so bad, to the point where I couldn’t even sleep,” she said. “I’d put my hand right by his nose, just to see if he was still breathing.”

Timbaland says he suffered a “near-death overdose” three years ago, which helped him kick his pill habit and get his life back on track.

“All I can tell you is that there was a light,” Timbaland said of the life-changing event three years ago. “I woke up trying to catch my breath, like I was underwater. But through that whole thing I saw life — I saw where I would be if I don’t change, and where I would be if I did.”

Today, he’s back in the gym and 40 pounds lighter. He’s also back in the music game, having just finished working on Justin Timberlake’s newest project.