Postherpetic neuralgia (PHN) is the most common complication of acute herpes zoster. The treatment of PHN remains a challenge for clinical pain management. The present study investigated the P2X7 receptor antagonist brilliant blue G (BBG) whether inhibits endoplasmic reticulum stress and pyroptosis (a necrotic form of cell death) and alleviates PHN. Varicella zoster virus (VZV)-infected CV-1 cells were used to induce PHN model. Mechanical paw withdrawal thresholds were measured using an ascending series of von Frey filaments. Immunohistochemistry was used to detect the expression of P2X7R in nerve tissues. Western blot was used to determine the expression of endoplasmic reticulum (ER) stress and pyroptosis-related molecules. The expression of IL-1β and IL-18 in tissue homogenate was detected by ELISA. The PHN rat has the lower paw withdrawal threshold, but higher expression of P2X7 in nerve tissues. And, endoplasmic reticulum stress was activated and pyroptosis was increased in PHN rats. BBG can decrease pain thresholds and reduce ER stress and pyroptosis in PHN rats. In addition, ER stress activator tunicamycin (TM) can reverse the effect of BBG on the paw withdrawal thresholds, endoplasmic reticulum stress, and pyroptosis. Therefore, P2X7 receptor antagonist BBG alleviates PHN by activating ER stress and reducing pyroptosis.