If your headaches cause you to lose sleep, a sleep aid may be an invaluable med to add to your arsenal. Not only will you sleep better, your better sleep might reduce the frequency or duration of your headaches.
The Mayo Clinic provides an excellent summary of the available sleep aids, including their side effects, precautions and warnings.