Ambien (zolpidem) is a prescription medication used to treat short-term insomnia by helping you fall asleep faster. It works by calming brain activity and is usually taken right before bedtime. To buy Ambien legally and safely, you’ll need a prescription from a licensed healthcare provider. Always follow your doctor’s instructions.