Both Quviviq and Ambien are effective oral prescription medicines used to help balance chemical effects in your brain that may cause trouble with sleep (known as insomnia). Quviviq and Ambien CR, an extended-release formulation, are used for people who have trouble getting to sleep or staying asleep through the night, while Ambien is used to help with sleep onset only because it has a shorter duration of action.