This is my experience/opinion, it's unreferenced and it may be wrong.
There's a form of meditation called awareness of the body or awareness of the breath. Maybe that form (or something like it) can be useful when you're trying to rest (or sleep).
'Awareness of the breath' means that you try to keep awareness of your breathing (e.g. the feeling of air flowing through the nose). It's described as being, like a hunter who waits for an animal next to its lair. The hunter knows that although the animal may be out, it will come back to the lair sooner or later. Similarly though the mind may be away, thinking about something else, it returns to the body sometimes.
If I'm awake in bed I'll try to be aware of various things.
One is breathing. If I'm not aware of breathing then maybe my thoughts (of whatever other things I'm thinking about) are keeping me awake. And part of the point of sleeping (IMO) is to have some nice relaxed breathing. Closing your eyes doesn't always cause sleep, but they ('sleep', and 'eyes closed') "co-arise" ... similarly, developing (enabling or participating in) some relaxed breathing (is it called 'oceanic' breathing?) may be a good condition for eventual sleep (and, even before sleep, it is a good condition for the body's resting and cleaning itself).
Another, is awareness of feeling in the body. For example I exercise my legs during the day, and blood circulation reroutes to go to feed those muscles e.g. in the calf. Meanwhile my feet get cold. In bed I feel (and promote the feeling of) places inside my calf muscle relaxing or unknotting, so that blood is freed to circulate through to elsewhere e.g. the feet, toes, skin. I think this kind of thing (i.e. changes in 'circulation') is a reason why (a mechanism via which) sleep is restful or restorative to the body.
So, I figure that if I'm in bed because I want to rest the body, then even if I'm not asleep (or before I'm asleep) I can consciously begin to rest the body. Knowing that the body is resting helps to reason with the mind: "Oh no, I'm not asleep! What a disaster, I'd better do something about it!" -- "Yeah don't worry about. You're relaxing the body already, the body is getting what it needs. Breathe again."
Another thing I find is that thoughts change as I go to sleep: I begin to dream. Dreaming takes the form of unexpected images ('unexpected' meaning 'inappropriate', unrelated to current events). For example (last night) I imagined a wolf's face. And then a spaceship (in outer space). Then the next thought was that this was going to be a story, of a wolf on a spaceship. The next thought was of a whale, shaped like a submarine, underwater. I'm not sure what to tell you about that: I think this kind of ideation/imagery is incompatible with conscious thinking, but it's a stage I seem to go through between conscious (waking) and unconscious (sleep). It's more spontaneous (randomly-generated), imaginative, and obviously a fantasy, than worrying-about-day-to-day thinking. So though I try to 'wake up' enough to discourage the 'worrying' type of thought (and return from there to consciousness of the body), but the 'dreaming' type of thought I just note ("this is the beginning of a dream/sleep"), my body is already deliberately resting, and maybe I'm asleep soon after that.
Lastly (and most dubiously) if you suffer from 'racing thoughts' (e.g. sometimes someone might say, "I couldn't get to sleep, I was up all night thinking!") there may be other techniques or 'objects' to occupy or on which to focus the mind, to stabilize emotions: a koan, a mantra, taking refuge in the Buddha, metta (mentioned in another answer), lack of remorse, visualizing oneself as if from the outside.