Recently, PTP1B was identified as a novel immune checkpoint whose removal can unleash T cell responses. However, research on the influence of PTP1B as an immune regulator on liver cancer is limited. This study aimed to investigate the immunological correlation and function of PTP1B in liver cancer. The expression profiles and corresponding clinical information of liver cancer patients were obtained from the TCGA and ICGC databases. GSE146115 and GSE98638 retrieved from the GEO database were used for the single-cell RNA-seq analysis. The mRNA expression of PTP1B (PTPN1) was increased in patients with most malignancies (all p < 0.05), including liver cancer ( p < 0.001). Furthermore, up-regulated PTPN1 was connected to advanced tumor stage ( p < 0.05) and worse prognosis ( p < 0.01) in liver cancer. Through Cox regression analysis, PTPN1 was considered as an independent prognosis factor of overall survival ( p < 0.05) and acted as a high-risk factor (hazard ratio > 1). Gene function and pathway analysis suggested PTPN1 was involved in T cell-related immune responses. Moreover, a close relationship was also found between PTPN1 expression and immune checkpoints as well as immune cells, especially with T cell-related checkpoints (all p < 0.001) and T cells (all p < 0.001). Single-cell RNA-seq analysis further illustrated that the enrichment of PTPN1 in the T cell population may be linked to its exhaustion in the liver cancer microenvironment. Overall, PTPN1 (PTP1B) closely related to T cell may function as an immunotherapy target for liver cancer.