Over 50% of patients with hepatitis B virus-associated hepatocellular carcinoma (HBV-HCC) are diagnosed at an advanced stage, which is characterized by immune imbalance between CD8+ T cells and regulatory T (Treg) cells that accelerates disease progression. However, there is no imbalance indicator to predict clinical outcomes. Here, we show that the proportion of CD8+ T cells decreases and Treg cells increases in advanced HBV-HCC patients. During this stage, CD8+ T cells and Treg cells expressed the coinhibitory molecule PD-1 and the costimulatory molecule ICOS, respectively. Additionally, the ratio between PD-1+CD8 and ICOS+Tregs showed significant changes. Patients were further divided into high- and low-ratio groups: PD-1+CD8 and ICOS+Tregs high- (PD-1/ICOShi) and low-ratio (PD-1/ICOSlo) groups according to ratio median. Compared with PD-1/ICOSlo patients, the PD-1/ICOShi group had better clinical prognosis and weaker CD8+ T cells exhaustion, and the T cell-killing and proliferation functions were more conservative. Surprisingly, the small sample analysis found that PD-1/ICOShi patients exhibited a higher proportion of tissue-resident memory T (TRM) cells and had more stable killing capacity and lower apoptosis capacity than PD-1/ICOSlo advanced HBV-HCC patients treated with immune checkpoint inhibitors (ICIs). In conclusion, the ratio between PD-1+CD8 and ICOS+Tregs was associated with extreme immune imbalance and poor prognosis in advanced HBV-HCC. These findings provide significant clinical implications for the prognosis of advanced HBV-HCC and may serve as a theoretical basis for identifying new targets in immunotherapy.