You can also try melatonin about 30 minutes before bed. A little calcium with that magnesium could also help, because it has a calming effect.
For best sleep, it's recommended that all electronics, TV's, etc be turned off an hour before bedtime, lights should be turned down lower, etc. The room you sleep in should be as dark and silent as possible; it should also be relatively cool.
There are many natural suppliments that work for sleep. Magnesiums that ends in "ate" like mag glycinate, turate , malate or citrate calm the muscles and brain. Mag oxide does nothing. Mag must be sep[arated from thyroid meds at least three hours.
Suppliment stores also have different safe mixes of herbs for sleep in capsules which work for many people. Valarian root, chamoile, lavender, lemon exracts as examples.
As far as actual medicine for sleep that doesnt need a script, NyQuil liquid sleep Z (not cold med) is pretty effective and liquid makes it work faster.
If you have insomnia, try magnesium (in chelated form such as citrate or glycinate) before you go to sleep. If you have kidney disease or severe heart disease you should take magnesium only under a doctor's supervision.
The risks of Ambien include sleep walking, confusion, "sleep-driving" while not fully awake with amnesia for the event, and risks of falls. A Harvard study of 1700 nursing home residents, with a mean age of 81, found that use of Ambien and its cousin drugs were associated with a 66% increased risk for hip fracture within 30 days of starting the drug for sleep.
I'm sure the cost on those meds would vary pharmacy to pharmacy and state to state. I've always found pharmacies very cooperative in giving you prices over the phone. You could also check online pharmacies. If the pills can be split in half (some tell you not to), you can ask your doctor to prescribe double the strength with instructions to take half a pill. Double strength is usually little to no more expensive per tablet.