The 39-year-old singer was ''days away from dying'' on several occasions and has compared himself to the late actor who died from an accidental overdose in 2008.
Speaking to the Daily Mail Weekend magazine, he said: ''I managed to escape by the skin of my teeth and I'm lucky. I was days away fro dying quite a few times on all manners of substances. There could easily have been a Heath Ledger kind of scenario.
''Unfortunately I've been in a place where I didn't care if I was on the planet or not. I do care now, but at the time I was so deep into addiction I knew I was probably going to die soon but I didn't care.
''I was taking a whole cocktail of drugs. My left arm went numb I was taking so much cocaine.''
Indeed, now Robbie - who has a 14-month-old daughter Theodora Rose with his wife Ayda Field - feels like he's looking back at a ''different person'', although he can admit he was having fun at the time.
He explained: ''It does seem like a different person. I had a lot of fun in between the woe. Nobody carries on taking drugs if they don't like them and I enjoyed my time among the reckless abandon.
''I managed to escape by the skin of my teeth and I'm lucky.''
The pair teamed together for another round of S&M romance in 'Fifty Shades Darker'.
The musician worked with screenwriter Johnny Harris on the new movie.
Affleck was recently confirmed to be NOT directing 'The Batman', despite many rumours that he would be doing so.
But what about Jack White and Alicia Keys?