Studies have shown that taking melatonin nightly is safe and effective. However, you should talk to your health care professional about long-term solutions.