This piece of advice comes straight from a Redditor in a familiar bind: sometimes we stay up way too late messing around on the internet or watching TV, when we should go to bed. This trick will help motivate you to get to bed and get to rest.
The idea is simple. When you realise that it's 3am and you're still playing mindless video games, ask yourself: would you be willing to wake up an hour or two early to do the same thing? If the answer is no, you're better off going to bed. If you're up late doing work, then you can better justify your tiredness the next day.
This doesn't mean it has to be something productive, of course — just something that you feel is worth your while. Take the above example: if a demo of your most-anticipated new video game release had just come out that evening, testing it might be more worth a certain lack of sleep. I know I'd wake up at 5am in a heartbeat if the demo was going to be released at 5am. It isn't a hard and fast rule, but it's a good question to ask yourself when you look at the clock and realise it's a bit later than you had planned on staying up.