So... vaccines?
Because that's what they do, more or less. Introduce little bits of virus so the body can fight it off if we actually come in contact with it, and by this, it means that other are less likely to catch it too.
(Technical stuff means that sometimes, we don't even get the actual virus, but that point doesn't really take away from the argument).