Play video content Exclusive TMZ.com

Artie Lange is days away from being 8 months clean and sober for the first time in decades, and he says the reason is ... he's finally facing the threat of prison.

The stand-up comedian joined "TMZ Live" Wednesday to talk about the long, dangerous road of addiction he's been on ever since getting busted for attempted bank robbery at 17-years-old.

He says things finally started to change after his arrest -- and sad mug shot -- earlier this year for a failed drug test.

Artie told us the judge placed him in drug court, which basically meant if he didn't stop violating probation and breaking laws, he would do hard time. He called it the first real consequence he's faced.

Lange says after spending 2 months in county jail, the possibility of going to prison was the wake-up call he needed to get clean. He also explained how his mom played a very important role.

Artie says drug court saved his life, and he's looking so much better than he did in January. Of course, his nose is still messed up, but like he told us ... there's a reason he's not in a hurry to get it fixed.