The human microbiome, often referred to as the ‘second genome’, encompasses up to 100-fold more genes than the host genome. In contrast to the human genome, the microbial genome is flexible and amenable to change during the host’s lifetime. As the composition of the microbial metagenome has been associated with the development of human disease, the mechanisms controlling the composition and function of the metagenome are of considerable interest and therapeutic potential. In the past few years, studies have revealed how the host immune system is involved in determining the microbial metagenome, and, in turn, how the microbiota regulates gene expression in the immune system. This species-specific bidirectional interaction is required for homeostatic health, whereas aberrations in the tightly controlled regulatory circuits that link the host immunogenome and the microbial metagenome drive susceptibility to common human diseases. Here, we summarize some of the major principles orchestrating this cross-talk between microbial and host genomes, with a special focus on the interaction between the intestinal immune system and the gut microbiome. Understanding the reciprocal genetic and epigenetic control between host and microbiota will be an important step towards the development of novel therapies against microbiome-driven diseases.