Well part of my insomnia was due to constant partying (and of course the substances and things you do when partying like a fucking animal).
To really break out of insomnia, you need to go to bed at the same time every night, not just random times of night. As much as you might want to, you shouldn't be stimulating your brain too much at night either. That stuff keeps you awake for way longer than you should be, so turn off that TV, turn off that computer and keep away from the game consoles