The half-life of caffeine is about 5 hours. However, it can range anywhere from 1.5 to about 9 hours, depending on the person. In many cases, people will need to wait until their body metabolizes it to sleep. The best way to prevent caffeine insomnia is to avoid it entirely during the second half of the day.