Two former Googlers, Jake Knapp and John Zeratsky who worked on Gmail and YouTube, have some advice for handling your caffeine habit.
They suggest you not drink coffee first thing. Perhaps wait until after 9:30 am. Cortisol is highest before that so its not needed earlier.
They say that caffeine doesn’t give an energy boost but prevents energy from waning. “If you wait until you are tired, it’s too late.” Since energy level goes down after lunch, have your second coffee half hour in advance.
If you miss that second cup in time, they suggest you take a nap.
Instead of another big cup of coffee in the afternoon, switch to tea or espresso (small cup), which have less caffeine.
Use proper timing for your last cup. Caffeine half-life it 5-6 hours so if your last cup is 4pm, you will still have half the effect of the caffeine at bedtime.