Background: Pneumocystis pneumonia (PCP) is increasingly being diagnosed in patients with systemic lupus erythematosus (SLE), and hydroxychloroquine (HCQ) has been found to possess antifungal activities. We hence aimed to investigate the association between HCQ and PCP risk among patients with SLE. Methods: Using the 1997-2013 nationwide claim data, we identified 24,343 newly-diagnosed SLE patients. We then identified 58 PCP cases and selected 348 non-PCP controls matching (1:6) by age, sex, disease duration and the year of PCP diagnosis date. The risk of PCP was assessed by determing odds ratios (ORs) with 95% confidence intervals (CIs) by using multivariable conditional logistic regression. Results: The risk of PCP was associated with moderate to severe renal disease (OR 6.73, 95% CI 1.98-22.92), higher doses of glucocorticoids (≤5 mg/day, reference; 5-10 mg/day, OR 25.88, 95% CI 2.97-225.33; > 10 mg/day, OR 286.58, 95% CI 28.58-> 999), higher 3-month cumulative dose of cyclophosphamide (not use, reference; ≤1.4 g, OR 0.64, 95% CI 0.14-3.01; > 1.4 g, OR 11.52, 95% CI 1.97-67.39) and use of mycophenolate mofetil/mycophenolic acid (OR 50.79, 95% CI 5.32-484.77), whereas 3-month cumulative dose of HCQ was associated with a reduced risk of PCP among patients with SLE (not use, reference; ≤14 g, OR 0.69, 95% CI 0.21-2.24; > 14 g, OR 0.20, 95% CI 0.05-0.71). Conclusions: This study demonstrated incident PCP was associated with mycophenolate mofetil/mycophenolic acid use and higher doses of cyclophosphamide or glucocorticoid, whereas the use of a higher dose of HCQ was associated with a reduced risk of PCP in lupus patients.