My mild tinnitus which I had for 10 plus years and never bothered me, became loud and intrusive 2.5 months ago with ear infection, every day I just pray to get through the day, it's such a miserable existence, feels like I'm being mentally tortured
There is no bullet proof way, just like you can't 100% protect yourself against the common cold or the flu, but you can take steps to minimize the chances, which are the typical hygiene recommendations (wash your hands, etc...).
For the ear, additional precautions include avoiding putting stuff in your ears, whether solid or liquid, as it could deposit germs inside the ear canal and develop an infection. See Swimmer's Ears (otitis externa).
If your ear is perforated for whatever reason, this is even more important since the middle ear is not protected from the elements anymore (by the ear drum), so germs can easily migrate into the middle ear and develop there.
When I put them in, I roll them and they expand inside of the ear canal. So there is no friction/irritation. I pull them out as slowly as I can. I had experienced irritation many months ago. I haven't been experiencing it for a long time now.
I accidentally washed my ear plugs in the wash machine, guess they were in my pocket, and they turned out really clean, looked brand new! So I've thrown them right in the washer, and seems to clean them up nice. Also I just buy new ones too