The microbiome can contribute to variation in fitness-related traits of their hosts, and thus to host evolution. Hosts are therefore expected to be under selection to control their microbiome, for instance through controlling microbe transmission from parents to offspring. Current models have mostly focused on microbes that either increase or decrease fitness. In that case, host-level selection is relatively straightforward, favouring either complete or no inheritance. In natural systems, however, vertical transmission fidelity varies widely, and microbiome composition is often shaped by a combination of vertical and horizontal transmission modes. We propose that such mixed transmission could optimize host fitness under fluctuating environments. Using a general model, we illustrate that decreasing vertical transmission fidelity increases the amount of microbiome variation, and thus potentially phenotypic variation, across hosts. Whether or not this is advantageous depends on environmental conditions, how much the microbiome changes during host development, and the contribution of other factors to trait variation. We discuss how environmentally-dependent microbial effects can favor intermediate transmission, review examples from natural systems, and suggest research avenues to empirically test our predictions. Overall, we show that imperfect transmission may be adaptive by allowing individuals to ensure phenotypic variability in their offspring in contexts where varying environments mean that this strategy increases long-term fitness.