He is still in high school but is no way going to graduate which will depress him even further.
So he expected to graduate high school even though he put xanax and opiates before his school work? It's hard to do well in school when you're bouncing in and out of the clink.
Personally, I think the best place for him, and for you, is jail. He may only be just south of 18, but he needs to learn that for every bad decision he makes, there are consequences for that. And I'm of the opinion you can't save him from himself.