You can lower your risk of pyelonephritis by:  Drinking plenty of fluids, especially water, to help clear bacteria from your body when you urinate. Urinating frequently. Urinating as soon as possible after having sex to clear bacteria from the urethra.