Eszopiclone is a medication primarily used for the treatment of insomnia. It belongs to a class of drugs known as nonbenzodiazepine hypnotics, and it is sold under the brand name Lunesta. Eszopiclone is prescribed to help individuals with difficulty falling asleep or staying asleep.