count sheep
(to imagine sheep jumping over a fence and counting them, as a way of making yourself go to sleep)
- I was counting sheep for about half an hour last night until I fell asleep.
- The doctor advised him not to drink coffee in the afternoon and try to count sheep.