In addition to mammalian immune systems that besiege the bugs, bacteria have natural enemies called bacteriophages, viruses that kill half the bacteria on Earth every two days.
Related article: Researchers discover biological basis of 'bacterial immune system'