If it's ruining your life, it's worth paying for the sleep study.
The two things they look for most, because they're most common, are sleep apnea and restless leg syndrome. I had a sleep study 3 years ago, and it wasn't worth the time/money. I knew I didn't have either.
HOWEVER, my husband had one shortly thereafter where he had a great follow-up appointment with the physician who read the results and explained why he was having the issues he was.
Ambien is not the only available product, and there are different strengths and formulations available (Ambien CR, for example, has an extended release component).
I haven't gotten a good night's sleep in almost a decade. Last night, I saw the clock at least once each hour. I do take something, but it's not generally prescribed as a sleep aid. It was an anti-nausea drug given to me after chemo treatments which helps me settle my brain long enough to fall asleep.
FYI - diphenhydramine is the active ingredient in Benadryl and is the sleep component of products such as Unisom, Tylenol PM, etc.