Summary. 1  Ambien and Lunesta are both prescription drugs intended for the treatment of insomnia. 2  Both can be availed of in tablet form. 3  Ambien and Lunesta have an immediate sedative effect that last 7-8 hours per dosage.  Ambien’s efficacy last up to 35 days, while Lunesta remains effective up to 6 months.