Bacteriophages - viruses that infect and replicate inside bacteria - undergo rapid degradation outside their hosts. Thus, a common expectation is that phages will minimize environmental exposure by maximizing their adsorption rate, i.e., infection rate. Here we show that, while maximized adsorption is a good strategy when bacterial host cells are healthy, situations exist where bypassing hosts may be beneficial, such as when host cells are not productive for infection. In these situations, optimal adsorption rates may take on intermediate values, thereby increasing phage dispersal. We aim to develop a theoretical understanding of the intermediate, optimal adsorption rate for phage λ, in environments where changing conditions lead to either good or poor quality hosts. We develop a Markov chain model and define optimal adsorption as the adsorption rate that maximizes the probability of survival. We impose experimentally-achievable periodicity in environmental change and derive novel analytic results for the probability of phage λ survival, from which optimal adsorption is computed. We then discuss the sensitivity of the phage survival probability to relevant biological parameters and environmental conditions. Finally, we extend these results to approximate the probability of phage λ survival when environment change is random, which better represents of natural dynamics, and show that stochasticity facilitates phage λ survival in sub-optimal conditions.