Ambien, also known as zolpidem, is a medication that is used to treat insomnia. It belongs to a group of drugs called sedative-hypnotics. Ambien works by slowing down brain activity and helping you fall asleep. Ambien can be taken orally or via injection. The effects of Ambien typically last between five and seven hours.