Scott Adams advises:
Don't think words. ... Let's say something is bugging you, or fascinating you, and the thought is keeping you awake. I'll bet that in those situations you're obsessed with the verbal elements of your problem. You're imagining what you will say to someone, or how you will explain yourself, or maybe what words someone else chose when annoying you. To fall asleep, don't abandon the troublesome topic, because you probably can't. Just picture the situation in images alone. That will satisfy the part of you that can't let go of the problem while putting you on the sleep trajectory.
(Photo from Imgur)