Valium is a brand name for a trade-named drug used to treat anxiety and insomnia. It's sometimes used as an insomnia aid, but the best way to get it prescribed is if you see your doctor about other problems with sleep. Valium is a medicine used to treat anxiety and panic attacks. It's also prescribed for some people who have trouble sleeping, or when you are having an adjustment period. Valium is a short-acting first-generation benzodiazepine used to treat anxiety and muscle spasms. It works by increasing the calming sensation that happens within your body after taking it.