It's something I continue to struggle with. I've tried melatonin too. Sometimes a glass of hot tea or warm milk before bed helps. I exercise late in the day so muscular tension adds to keeping me awake. Meditations and prayer or just reading a book can do wonders.
Keep trying different things. Eventually you'll find what works for you, but keep in mind you might have to change up your methods and routine too.