Yes, melatonin is commonly used as a treatment for insomnia, particularly for those with difficulty falling asleep. It can help regulate the sleep-wake cycle and improve sleep onset and quality. However, it may be most effective for certain types of insomnia, such as transient or situational insomnia, rather than chronic or severe cases. Consulting a healthcare professional for personalized guidance on melatonin use is advisable when treating insomnia.