To overcome any addiction, you have to leave the substance and also tackle the root cause. In your case its loneliness and anxiety. This will go away by making friends and learning how to get your confidence back.
Next Steps
A counsellor can guide you how to make friends and feel more confident if you lack the knowledge.
Health Tips
In order to abstain from prescription drugs, stop stocking them, stay away from situations where you will likely use them, keep yourself usefully occupied.