I struggled with this for years...and agree at the end of the day the best way to stay awake is to sleep well (sometimes before/ after a duty...sometimes controlled rest during the cruise).
Melatonin works (after a duty)....but long term use makes it difficult for you to sleep without ever increasing doses.
The biggest two problems were noise and light encroachment...even if I was exhausted! Then I found this (post 25 onwards)
http://www.pprune.org/questions/4727...ml#post7044170
.....problem solved!!!!!!!!!!