Aims/Background Hepatitis B virus (HBV) infection poses a challenge to global healthcare. Peginterferon alfa-2b (PEG-IFNα-2b) is an effective treatment for HBV infection. This study aimed to explore the efficacy of PEG-IFNα-2b combined with entecavir in the treatment of HBV infection, its effect on liver function and immune factors, and the risk factors affecting the prognosis of patients with HBV infection. Methods The clinical data of 184 patients with HBV infection who were treated at Jinhua Central Hospital from January 2021 to January 2024 were collected for retrospective analysis. Patients were divided into a control group (not receiving antiviral treatment, n = 34), a standard treatment group (receiving entecavir, n = 85), and a combination treatment group (PEG-IFNα-2b and entecavir, n = 65) according to the treatment approach. Treatment efficacy, liver function indicators (albumin [ALB], alanine aminotransferase [ALT], and aspartate aminotransferase [AST]), immune factor indexes (tumour necrosis factor alpha [TNF-α] and interferon gamma [IFN-γ]), hepatitis B surface antigen [HBsAg] and HBV DNA levels were compared among the three groups. All patients were followed up after treatment. According to their prognosis, the patients were divided into good prognosis group (n = 118) and poor prognosis group (n = 66). Logistic regression analysis was performed to explore the risk factors affecting the prognosis of HBV patients. Results The efficacy in the combination treatment group was higher (92.31%) than that in the control group (8.82%) and the standard treatment group (78.82%) (p < 0.05). After treatment, the HBsAg and HBV DNA levels were decreased in the standard treatment and combination treatment groups (p < 0.05). Compared with the control and standard treatment groups, the combination treatment group exhibited significantly lower HBsAg and HBV DNA levels after treatment (p < 0.05). Besides, the combination treatment group had lower ALT and AST levels (p < 0.05), and higher ALB level (p < 0.05), than the control and standard treatment groups after treatment. Compared with the control and standard treatment groups, the combination treatment group demonstrated decreased TNF-α level and higher IFN-γ level after treatment (p < 0.05). Multivariate logistic regression analysis identified family medical history as the risk factor affecting the prognosis of patients with HBV infection (p = 0.001, odds ratio [OR] = 3.614, 95% confidence interval [CI]: 1.685–7.750) and therapy regimen as the protective factor (p = 0.029, OR = 0.135, 95% CI: 0.022–0.815). Conclusion The PEG-IFNα-2b combination therapy in patients with HBV infection significantly improves the clinical treatment efficacy, liver function, and immune factors. In addition, this study found that therapy regimen and family medical history are independent factors affecting the prognosis of HBV infection.