Yes, and often more usefully than a quick sleep-aid script, because insomnia is usually a symptom with a driver: anxiety, depression, ADHD medication dosed too late, alcohol, sleep apnea.
The toolbox runs from non-controlled options (trazodone, ramelteon, low-dose doxepin, hydroxyzine) to short, justified stretches of controlled sleep aids, alongside CBT-I, the behavioral treatment with the best long-term evidence. Treat the driver and sleep often improves within the first two weeks, before mood does. That's not a coincidence; it's the order recovery usually runs in.