Coffee in proximity of sleep-time will keep me up all night because I have a messed up circadian rhythm as it is (28 hours).
I usually "downgrade" to tea later in the day and maintain a consistent melatonin regimen. Melatonin is well-attested in its ability to improve sleep quality:
http://www.ahrq.gov/clinic/epcsums/melatsum.htm
I wouldn't count on the efficacy of melatonin unless you are sleeping 6-8 hours a night and are otherwise healthy and devoid of a sleep disorder.
People like to mention vitamin D, but taking it as a supplement is correlated with worse sleep, not better. As a counter-suggestion to vitamin D supplementation I would avoid artificial light exposure (use Flux if possible) after sunset as well. (This has been shown to produce delayed onset sleep patterns.)
That's the only real factual data I have for this, I would avoid relying on anecdote.
This was not medical advice, just a citation of facts.