So kicking the habit is akin to having the flu real bad for a week or so, maybe less? Hell, if I didn't respect myself as much as I do, I'd get hooked just to kick the habit and laugh at all the weak fvckers who can't do it on their own. I have a real distaste for weakness in people and drug use is one of the worst forms of human weakness.
Then again, I'm one of the most bull-headed, strong willed people that anyone has ever known. I do crazy $hit like compete in marathons with three weeks training while losing 15 pounds and doing the entire 26.2 miles through a desert in Arizona, but that's just me. Oh, I did it because someone said I couldn't and I ended up beating them across the line by using sheer determination, because believe me, I wasn't in shape for it.
My best advice is to stick by your friend and point out all of the things he's losing or will lose by going to jail or dying from his addiction. Also, if you're going to help him through this, you better damn well be in it 110% for the whole time, otherwise you'll just be one more excuse for him to go back to using. I'd pretty much say that if you don't get physical (ie.-fighting) at least once with him, you're probably not pushing him hard enough. I'm a relentless a$$hole when dealing with someone's weakness though, so maybe that's not good advice.