Ambien is used to treat insomnia. The immediate release tablet is used to help you fall asleep when you first go to bed. The extended release form, Ambien CR, which has a first layer that dissolves quickly to help you fall asleep, and a second layer that dissolves slowly to help you stay asleep. Ambien may cause a severe allergic reaction. Stop taking this medicine and get emergency medical help if you have any of these signs of an allergic reaction: hives; difficulty breathing; swelling of your face, lips, tongue, or throat.