The diversity of microbes associated with plant roots is enormous, in the order of tens of thousands of species. This complex plant-associated microbial community, also referred to as the second genome of the plant, is crucial for plant health. Recent advances in plant–microbe interactions research revealed that plants are able to shape their rhizosphere microbiome, as evidenced by the fact that different plant species host specific microbial communities when grown on the same soil. In this review, we discuss evidence that upon pathogen or insect attack, plants are able to recruit protective microorganisms, and enhance microbial activity to suppress pathogens in the rhizosphere. A comprehensive understanding of the mechanisms that govern selection and activity of microbial communities by plant roots will provide new opportunities to increase crop production.