Sexual activity can increase the likelihood of contracting a UTI. However, there are a few tricks you can use to help prevent urinary tract infection:
Make sure any lubricants you use are water-based and try to avoid douching, especially since the vagina typically regulates itself after intercourse.
Try to urinate shortly before and after sex. This can help reduce the amount of bacteria that might cling to the urethra during intercourse.
If you use a diaphragm or spermicidal agent, consider modifying your birth control. Other methods like the pill or condoms with non-spermicidal lubricant, are known to cause less irritation, which may lead to the rise of less bacterial growth.