Aims/Background Postherpetic neuralgia (PHN) is a common chronic pain disease that persists after the rash (clusters of clear blisters on the surface of the skin) has healed, adversely affecting the quality of life of affected patients. Gabapentin (GPT) and pregabalin (PGB) are two commonly used drugs for the treatment of PHN, but there have been broad concerns regarding their efficacy and safety. Thus, this retrospective cohort study was conducted to investigate the effectiveness and safety of GPT versus PGB in the treatment of PHN. Methods A total of 150 patients with PHN receiving routine antiviral and neurotrophic therapies, admitted between January 2022 and November 2023, were selected. 71 patients who were treated with GPT were included in the control group, while the remaining 79 patients who were given PGB were categorized in the observation group. Information on clinical effectiveness, safety (xerostomia, drowsiness, blurred vision, ataxia, and dizziness), analgesic effect (Visual Analogue Scale [VAS] and time to pain relief), sleep quality (Sleep Quality Scale [SQS] and Pittsburgh Sleep Quality Index [PSQI]), and adverse emotions (Self-rating Anxiety/Depression Scale [SAS/SDS]) was collected for analysis. Results Compared to the control group, the observation group exhibited significantly higher clinical effectiveness of PGB in the treatment of PHN (p < 0.05). In other aspects, the overall incidence of adverse events such as xerostomia, drowsiness, blurred vision, ataxia, and dizziness (p > 0.05) was equivalent in these two groups. In addition, significantly lower VAS, SQS, PSQI, SAS, and SDS scores were observed in the observation group after treatment, compared with the control group (p < 0.05). The observation group showed evidently shorter time to pain relief than the other group (p < 0.05). Conclusion PGB is an effective and safe medication for the treatment of PHN, by improving the analgesic effect and sleep quality, and alleviating negative emotions.