nigel i have been taking 2mg xanax for sleep 4 years,with no ill effects.my doctor said try to get off xanax and take ambien.there is so much conflicting evidence about long term side effects with ambien,dont know who is correcti know ambien and xanax work on simular gaba.would switching to ambien be safer over xanax.i am 79 years old.would it be safer in the long run because xanax you can take forever/ambien they say take 10 days.i have read reports that people are on ambien for years with no problem.
Unless your doctor is under pressure from some source to reduce his benzodiazepine prescribing or there is some other reason for concern, I am struggling to see what real benefit you will get from changing night sedation.
After such long usage, withdrawal from Xanax could be equally problematic as stopping Ambien after a similar period, plus the potential for problems through the transition. In many patients the level of unrecognised psychological dependence can be high.
Neither drug should cause hang-over sedation into the next day, which would be a risk of falls etc. So if you are comfortable on Xanax, my inclination would be to leave well alone. Given your age and the length of use, any change is likely to be difficult, whether obvious anxiety or greater problems.
What I would not do though is increase the dose of Xanax. If the current dose becomes insufficient, then a phased transition to a non-benzodiazepine such as Ambien would be a better approach.
However, whatever my views, your doctor carries clinical responsibility and has more experience and knowledge than I do.
I hope this helps.