UTI prevention help

Nearly every time my boyfriend and I have sex, I get a UTI. I make sure to urinate after sex and wash up but I’m still getting painful UTI’s. Anyone else had this problem???