Host microbiomes are important regulators of organismal fitness, physiology, and ecology. Microbiomes promote the fitness of their host in part by buffering the host from the full effects of fluctuating conditions and stressors imposed by the external environment. Whether the host conversely serves as a buffer for their associated microbes against variation in the external environment is less clear. Here, we test if bacteria inhabiting the microbiome of a host are locally adapted to nutrient levels in their surrounding external environment. We used a system in which the host, the phytoplankter Microcystis aeruginosa, has strains that are locally adapted to low-nutrient versus high-nutrient lakes. Assessing 40 metagenome-assembled genomes belonging to four taxonomic groups of heterotrophic bacteria residing within the host microbiome, we found consistent phylogenetic divergence between strains originating from low-nutrient versus high-nutrient environments. Bacteria found in association with low-nutrient host genotypes obtained from low-nutrient lakes demonstrated genome streamlining, including reduced genome size and fewer sigma factors. These bacterial genomes have features that would facilitate survival in low-nutrient lakes, including (i) greater number of alkaline phosphatase genes that are essential for phosphorus acquisition and (ii) positive selection within genes involved in phosphorus metabolism. Overall, our results demonstrate that despite living in close association with host organisms, bacteria residing within microbiomes may have evolved and undergone environmental selection to stressors external to their host, demonstrating similar patterns of adaptation to those that might be expected to develop among free-living bacteria. IMPORTANCE Understanding how natural selection has historically shaped the traits of microbial populations comprising host microbiomes would help predict how the functions of these microbes may continue to evolve over space and time. Numerous host-associated microbes have been found to adapt to their host, sometimes becoming obligate symbionts, whereas free-living microbes are best known to adapt to their surrounding environment. Our study assessed the selective pressures of both the host environment and the surrounding external environment in shaping the functional potential of host-associated bacteria. Despite residing within the resource-rich microbiome of their hosts, we demonstrate that host-associated heterotrophic bacteria show evidence of trait selection that matches the nutrient availability of their broader surrounding environment. These findings illustrate the complex mix of selective pressures that likely shape the present-day function of bacteria found inhabiting host microbiomes. Our study lends insight into the shifts in function that may occur as environments fluctuate over time.