Every frustrating experience provides an opportunity to grow. Not being able to sleep at night can be an especially frustrating experience. Meditation can help with both the frustration and the insomnia.
Meditation is not a lot different from counting sheep. You just count your breaths and try not to imagine sheep. If you are not sure you are going to be awake for a while, then you can try meditating lying down. Count your breaths from one to ten and when thoughts distract you from your counting, dismiss them and go back to your breath. If you can count all the way to ten several times, then you can get up and try sitting meditation.
When you get up to do sitting meditation, plan to sit for 10-15 minutes if you are just beginning and 20-30 minutes when you are experienced. Put some cushions on the floor and face a wall, cross your legs, put your hands in your lap and sit with your spine straight. Start with a long exhale and then count your breaths from one to ten. When your time is up go back to bed and continue the meditation. If you don’t fall asleep try again.
Practicing meditation during periods of insomnia is good for several reasons. It is good for your meditation practice because the middle of the night is a quiet time and you are unlikely to be interrupted. Also, when you can’t sleep, your mind is alert and that alertness is useful in meditation. Finally, meditation is not that much different from sleeping in terms of getting the rest that you need. There are monks who meditate day and night without sleep for weeks at a time.
If you are worried about being able to sleep you can also meditate just before going to bed. That can help too. Sweet dreams.