Infections by filamentous phages, which are usually nonlethal to the bacterial cells, influence bacterial fitness in various ways. While phage‐encoded accessory genes, for example virulence genes, can be highly beneficial, the production of viral particles is energetically costly and often reduces bacterial growth. Consequently, if costs outweigh benefits, bacteria evolve resistance, which can shorten phage epidemics. Abiotic conditions are known to influence the net‐fitness effect for infected bacteria. Their impact on the dynamics and trajectories of host resistance evolution, however, remains yet unknown. To address this, we experimentally evolved the bacterium Vibrio alginolyticus in the presence of a filamentous phage at three different salinity levels, that is (1) ambient, (2) 50% reduction and (3) fluctuations between reduced and ambient. In all three salinities, bacteria rapidly acquired resistance through super infection exclusion (SIE), whereby phage‐infected cells acquired immunity at the cost of reduced growth. Over time, SIE was gradually replaced by evolutionary fitter surface receptor mutants (SRM). This replacement was significantly faster at ambient and fluctuating conditions compared with the low saline environment. Our experimentally parameterized mathematical model explains that suboptimal environmental conditions, in which bacterial growth is slower, slow down phage resistance evolution ultimately prolonging phage epidemics. Our results may explain the high prevalence of filamentous phages in natural environments where bacteria are frequently exposed to suboptimal conditions and constantly shifting selections regimes. Thus, our future ocean may favour the emergence of phage‐born pathogenic bacteria and impose a greater risk for disease outbreaks, impacting not only marine animals but also humans.