There are very many headache food triggers known to researchers now. Consumption of caffeine can have an unpredictable effect on the frequency and severity of your headaches. The main problem is that it is difficult to predict which effect it will have. Coffee can either reduce your existing headache or start a new one. Many people do not even realize that since a previous cup of coffee started their headache in the first place that another cup will just make it worse.
Therefore the most important thing that you can do to help reduce your headache is to reduce your caffeine consumption. After you have reduced it, you should consider settling into a routine. You do not want to try to eliminate it entirely, that could bring on serious caffeine withdrawal pains, which could cause you to run back to pain relievers that we are trying to avoid.
Caffeine can be a very effective headache reducer, especially migraines, but it can also be a headache trigger if you come to rely on it too much. Try reducing to two or three cups a day at specified times. For example, you could decide that you will only drink coffee in the morning and at 2pm. This should not only control your headaches but also help you to appreciate your coffee breaks more.
It is not always possible or desirable to drink at exactly the same time everyday but the closer you can get to a regular routine the better off you will be for it.