This could be a sinus headache or a migraine. Do you have nasal symptoms with it? Have you tried over-the-counter nasal decongestants when this happens? They may help if that is what it is, just be sure not to use them too often because you can get re-bound sinus pressure.
If it's a migraine, you'll probably have sensitivity to light, noise, and/or smells, some have nausea and even vomiting.
Either way, you should see a doctor about this. If you think it's sinus related, go to your primary doctor or an ENT (Ear, Nose, and Throat doctor). If you think it's a migraine, go to your primary doctor or a neurologist who specializes in headaches. Write down all your symptoms, when you get them (what happens before), and any questions you have. There are treatments for both of these. You don't have to suffer with these headaches.