Reducing anxiety or producing drowsiness or anesthesia before certain medical procedures or surgery. It may also be given continuously to maintain sedation or anesthesia in certain patients. It may also be used for other conditions as determined by your doctor. Midazolam is a benzodiazepine. It works in the central nervous system (brain) to cause sleepiness, muscle relaxation, and short-term memory loss, and to reduce anxiety.