Lunesta is a prescribed medication used to treat insomnia and sleeping problems. Lunesta never takes this medicine during your normal working hours, unless you have slept 7 to 8 hours. To take this medicine at night time for better effect. So you can get a better night's rest. Lunesta belongs to a class of drug called sedative-hypnotics.