The best way is to lower your dosage.
If you had 1mg of Xanax and passed out, try 0.5mg next time.
If you pass out on 0.5mg, try 0.25mg.
Most people wouldn't pass out from just 0.25mg of Xanax, but I know someone who did.
The next step would be to try 0.125mg, and then if you still pass out, I'm not sure if you would even feel a lower dosage but it is worth a shot if this is what you're going for.
Some benzodiazepines are supposed to put you to sleep as this is what they are used for in medicine. Temazepam being the best example, as it does not interrupt your REM sleep.
Don't sit down or lay down if you want to remain awake - stay active and moving. When you want to go to sleep lay down and make sure you are in a comfortable position. I have seen people pass out on benzos in a really uncomfortable position and then they put unnecessary strain on their necks or limbs. It can be quite painful when you wake up and you are for the first time, starting to feel the pain from this.