Melatonin is a hormone that is naturally produced by the body. Taking melatonin at night can help prevent cluster headaches. It can also help prevent cluster headaches from disrupting your sleep.