I have had insomnia since I was a kid and have to change sleep meds every few years. Oh and I have anxiety/ocd and ADHD. I was on an extended release form of ambien prior to surgery and just like you, I found that it stopped working. I had to add alprazolam to it to sleep through the night, but that's not great long term. My therapist said because of the absorption rate, going back to the highest dose of ambien should fix that.
Unfortunately I still struggled to sleep more than 3 hrs unless I added the alprazolam again. But I recently tried alcohol free zzzquil in its place and it does the trick! I started with a 15ml dose and I'm adjusting down from that, because it was a little hard to wake up the first time but I wasn't groggy at all. Hopefully this works for you too or gets you closer to something that does!