Counting sheep, the writer's version
Lately I've rarely been able to sleep straight through the night. Inevitably I wake up at about 2 or 3 a.m., much too alert, and struggle to get back to sleep. (I wonder if there's something this myth of the eight-hour sleep business after all.) Though tempting, I try not think through whatever fiction project I'm working on at the time - conjuring settings and plot situations are much too mentally engaging for me to get sufficiently drowsy. And counting sheep has never really worked for me.
I've recently hit on a trick that seems to work, which I'll call first name-last name. One challenge faced by fiction writers is inventing characters' names, which fit both their personalities and backgrounds while also being poetic or at least memorable. So my trick is to randomly think of a first name, and then a last name that goes with it. Frequently the initial last name chosen creates the name of a celebrity (which would be cheating and not at all creative), so if I have "Robert" and first think of "DeNiro", I abandon that last name and think of another, such as "Woodside." And after Robert Woodside, I think of a new first name that begins with W, and continue on from there. I know this might also sound too mentally engaging for drowsiness, but the names come and go quickly, in a free-association sort of way, and their steady progression usually lulls me back to sleep.
Try it sometime. The only thing I warn is to not choose too many last names that begin in L or M - I often find myself gravitating toward the center of the alphabet, and before long I've run out of the standard L or M first names and have to settle for Langley and Mervin. Try for the ends of the alphabet instead.