When you know &feel that it is a very bad habit, then it is easy to get rid of it.
First you promise that what may come you go to sleep at 9o clock.
Pray 5 times &read Quran with translation daily.
After ESHA prayer you go to sleep. INSHALLAH you will be helped by Allah.