Rebound headaches are most likely what you are experiencing.
First of all, you need to find out what started your headaches and followup accordingly. Basically the treatment of rebound headaches involves reducing the frequency of your offending "rebounding medicine". You need ot get on preventive or prophylactic (preventive) medicine. There are a number of these medications that can really help.