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 the 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 the bottleneck size in gut microbiota, we then tested in vitro the influence of bottleneck 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 could not 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. This should also be applicable to infections in other organisms that use AMPs as an immune defense.