Hello and hope you are doing well.
Ambien is only meant to be used for short term use which often results in worsening of insomnia (sometimes worse than it ever was) when trying to come off the medication. Either way to most of the sedatives (sleeping tablets), people develop tolerance, that is they stop working very effectively with time. So, try to develop good sleep hygiene. Sleep and get up at the same time every day, avoid smoking, alcoholic and caffeinated beverages and exercise regularly. Please discuss this with your doctor.
Hope this helped and do keep us posted.