up to three hours before bed latest time you can drink coffee restful sleep may be disturbed by that cup of coffee closing the coffee door at 2 p.m stop drinking coffee during the day experienced sleep disturbance