A little more detail
A physiological hormone that plays a part in sleep timing, also used from outside as a medicine or supplement. In a meta-analysis pooling 12 randomised controlled trials, the most convincing evidence was for a shorter time to fall asleep in primary insomnia and delayed sleep phase syndrome, and for regulating the sleep wake pattern in blind people. The AASM 2017 guideline, on the other hand, gives a weak recommendation against using melatonin to fall or stay asleep in chronic insomnia. You should talk to a doctor before using it.
Source: Auld F, Maschauer EL, Morrison I et al. Evidence for the efficacy of melatonin in the treatment of primary adult sleep disorders. Sleep Med Rev. 2017;34:10-22. doi:10.1016/j.smrv.2016.06.005; Sateia MJ, Buysse DJ, Krystal AD et al. Clinical practice guideline for the pharmacologic treatment of chronic insomnia in adults: an American Academy of Sleep Medicine clinical practice guideline. J Clin Sleep Med. 2017;13(2):307-349. doi:10.5664/jcsm.6470