Phages and their bacterial hosts together constitute a vast and diverse ecosystem. Facing the infection of phages, prokaryotes have evolved a wide range of antiviral mechanisms, and phages in turn have adopted multiple tactics to circumvent or subvert these mechanisms to survive. An in-depth investigation into the interaction between phages and bacteria not only provides new insight into the ancient coevolutionary conflict between them but also produces precision biotechnological tools based on anti-phage systems. Moreover, a more complete understanding of their interaction is also critical for the phage-based antibacterial measures. Compared to the bacterial antiviral mechanisms, studies into counter-defense strategies adopted by phages have been a little slow, but have also achieved important advances in recent years. In this review, we highlight the numerous intracellular immune systems of bacteria as well as the countermeasures employed by phages, with an emphasis on the bacteriophage strategies in response to host antiviral immunity.