Two. Coffee is an evening drug
Caffeine hangs around far longer than people assume. Roughly half of it is still in you about five or six hours later, and half of that is still there five or six hours after that.
Which means the coffee at four in the afternoon is still working on you at ten at night. It may not stop you falling asleep. What it tends to do is make the sleep lighter and more broken, so you get the eight hours and none of the benefit, and then you reach for more coffee the next day.
You do not have to give it up. Move the last one to the morning for two weeks and see what the nights do. And check what else it is in, because tea, energy drinks, some painkillers and a lot of soft drinks all count.