Ambien is a sedative-hypnotic medication used to treat insomnia in adults. It works by affecting certain chemicals in the brain to help you fall asleep faster and stay asleep longer. Ambien is available in both immediate-release and extended-release formulations, with the extended-release version helping individuals stay asleep throughout the night.