Bottlenecks, a severe reduction in population size, are ubiquitous for bacteria in natural systems. For example, during the complete metamorphosis of insects, the gut microbiota is bottlenecked due to a massive secretion of immune effectors such as antimicrobial peptides (AMPs) into the gut. However, the effect of natural bottlenecks on resistance evolution of bacteria to AMPs is currently unknown. Here we measured the bottlenecking of the gut microbiota of G. mellonella, the greater wax moth. Based on these population estimates, we tested in vitro the influence of population size on the adaptation of E. coli against an AMP. We used wild-type E. coli and mutator strains with a 100-fold increase in mutation rates to partly disentangle population size from mutant supply. We found that large E. coli mutator strain populations evolved higher resistance than small populations. Population size, however, did not affect adaptation in wild-type strains. They were not able to evolve resistance under our experimental conditions. This shows that natural bottlenecks can benefit insect hosts by combating the evolution of AMP resistance to their resident gut microbiota, but this should also be applicable to infection in other organisms that use AMPs as an immune defense.