When I start to have trouble getting to sleep, I give up caffeine. This is more difficult now that I am living at home, where my mother and SO both enjoy tea (and yes, with the minimal caffeine intake I have, tea DOES affect me) and the woman I am temporarily working for offers me coffee every morning. I finally picked up an enjoyment for the taste of coffee about 6 months ago (after despising it for years), and now it makes me a little sad that it affects me so strongly that I can't drink much without absolutely destroying my sleep schedule.
If I drink a caffeinated beverage, it has to be well before 11 am if I have a bedtime of 10 or 11 pm, otherwise it will be difficult to fall asleep and I fail to sleep well.