You need to be conscious of the three risk factors. For example, if you only got three hours of sleep yesterday and you didn't have a chance to take a nap, an alarm should go off in your head warning you that you're at higher risk than usual. Take a nap. Apart from letting someone else drive or checking into a hotel, taking a nap before you drive is the number one thing you can do to reduce your accident risk. Use caffeine wisely.
Caffeine is a double-edged sword.
On the plus side, it does boost your alertness and performance, generally about 30 minutes after you ingest it. On the down side, it can upset your stomach and make it harder to sleep once you get home. Although it may be helpful in an emergency, you should not rely on caffeine to keep you safe when driving. Having someone to talk to keeps your mind engaged and reduces the likelihood that you'll fall asleep at the wheel.