Caffeine is a drug and when used on a daily basis, it can cause rebound headaches. Regular use can make a person with migraines dependent on caffeine. My friend grinds his teeth at night and wakes up with headaches. Grinding one's teeth can cause tension headaches. You should see your dentist and consider a bite block.
Many medications can cause headaches.
With your doctor's advice, taper off of them and maybe substitute them with something else to see if your headaches improve. I had acupuncture for a while which seemed to work, but now I'm getting them back again. My suggestion would be to seek out a headache specialist. If your own physician is at a loss of what to do at this point, you should ask him for a referral to a headache specialist. The National Headache Foundation can offer referrals.