Krüppel-associated box-domain zinc finger protein (KRAB-ZFP) transcriptional repressors recruit TRIM28/KAP1 to heterochromatinize the mammalian genome while also guarding the host by silencing invading foreign genomes. However, how a KRAB-ZFP recognizes target sequences in the natural context of its own or foreign genomes is unclear. Our studies on B-lymphocytes permanently harboring the cancer-causing Epstein-Barr virus (EBV) have shown that SZF1, a KRAB-ZFP, binds to several lytic/replicative phase genes to silence them, thereby promoting the latent/quiescent phase of the virus. As a result, unless SZF1 and its binding partners are displaced from target regions on the viral genome, EBV remains dormant, i.e. refractory to lytic phase-inducing triggers. As SZF1 also heterochromatinizes the cellular genome, we performed in situ footprint mapping on both viral and host genomes in physically separated B-lymphocytes bearing latent or replicative/active EBV genomes. By analyzing footprints, we learned that SZF1 recognizes the host genome through a repeat sequence-bearing motif near centromeres. Remarkably, SZF1 does not use this motif to recognize the EBV genome. Instead, it uses distinct binding sites that lack obvious similarities to each other or the above motif, to silence the viral genome. Virus mutagenesis studies show that these distinct binding sites are not only key to maintaining the established latent phase but also silencing the lytic phase in newly-infected cells, thus enabling the virus to establish latency and transform cells. Notably, these binding sites on the viral genome, when also present on the human genome, are not used by SZF1 to silence host genes during latency. This differential approach towards target site recognition may reflect a strategy by which the host silences and regulates genomes of persistent invaders without jeopardizing its own homeostasis.