Small randomized sleep study
A high caffeine dose affected sleep even several hours before bed.
Drake et al. tested 400 mg caffeine at bedtime, 3 hours before bedtime, and 6 hours before habitual bedtime. Each timing disrupted sleep compared with placebo in a small adult study.