CBT-i more or less fixed me too. It should be noted that sleep restriction (the practice you're describing here) is only part of CBT-i but it seems to be the most important.
I also gave up coffee and I stop looking at screens 30-60 mins before my bed time. Before the therapy ~30% of my nights were sleepless.
This article helped a lot: http://ilya.sukhar.com/blog/an-algorithmic-solution-to-insom...