To hold your pee with no bathroom in sight, you should avoid shaking or jarring your body too much. Move around puts pressure on your bladder and increases the urgency to pee. If you want to hold pee, sit still, and do not go for a walk or jog.
If you are already sitting, adjust yourself in a comfortable position. If that position makes you uncomfortable after some time, reposition yourself. Moreover, avoid sudden movements.
Instead of sitting and thinking about how urgently you need to pee, focus on the surroundings. Feel the warmth of your sun or the rate of your breathing. You can also direct your focus towards the children playing or the people walking. Whenever I need to pee in the park, I usually distract myself with the sound of bees and the light breeze touching my face.
If you are at a place where you can sit on the ground, try meditating or repeating a mantra. You can also try deep breathing exercises.
If I can’t concentrate on my surroundings, I meditate by squeezing the muscles around my urethra to control the pee.
The build-up of gas puts additional pressure on your bladder besides urine. However, you can alleviate the pressure by passing gas. Passing gas usually puts me in a comfortable position and I tend to hold my pee longer whenever I am waiting in a bathroom queue.
However, you can lose control temporarily if you are attempting it for the first time. If you think you will let your pee out by-passing gas, try making physical adjustments to your body.