Immune checkpoint inhibitors targeting programmed cell death protein 1 (PD-1) or programmed cell death 1 ligand 1 (PD-L1) have enabled some patients with cancer to experience durable, complete treatment responses; however, reliable anti-PD-(L)1 treatment response biomarkers are lacking. Our research found that PD-L1 K162 was methylated by SETD7 and demethylated by LSD2. Furthermore, PD-L1 K162 methylation controlled the PD-1/PD-L1 interaction and obviously enhanced the suppression of T cell activity controlling cancer immune surveillance. We demonstrated that PD-L1 hypermethylation was the key mechanism for anti-PD-L1 therapy resistance, investigated that PD-L1 K162 methylation was a negative predictive marker for anti-PD-1 treatment in patients with non-small cell lung cancer, and showed that the PD-L1 K162 methylation:PD-L1 ratio was a more accurate biomarker for predicting anti-PD-(L)1 therapy sensitivity. These findings provide insights into the regulation of the PD-1/PD-L1 pathway, identify a modification of this critical immune checkpoint, and highlight a predictive biomarker of the response to PD-1/PD-L1 blockade therapy.