Bilirubin is widely recognized to possess antioxidant and anti-inflammatory characteristics. However, the relationship between bilirubin and coronary artery disease (CAD) remains controversial, particularly in individuals receiving Percutaneous Coronary Intervention (PCI). Given that statins may enhance the production of heme oxygenase-1 (HO-1) and bilirubin, we investigated the long-term cardiovascular prognostic role of bilirubin levels elevated by statin use in patients undergoing PCI. Data of 6945 subjects undergoing PCI were enrolled in this study. We divided the patients into two groups based on serum total bilirubin (TB) levels detected prior to PCI. The high TB group consisted of patients with serum TB values > 8.4 μmmol/L, while the low TB group consisted of patients with serum TB values ≤ 8.4 μmmol/L. The median follow-up time was 836 days. Cox proportional hazards models were performed to evaluate the hazard ratios (HRs) and 95% confidence interval (CI) for the incidence of major adverse cardiovascular event (MACE) associated with bilirubin levels. The association between TB levels and risk of MACE was significant [adjusted HR = 0.557, 95% CI (0.59–0.96), p = 0.020). Linear analysis was performed to determine the association between preadmission usage of statin and bilirubin level. The preadmission usage of statin independently linearly increases TB [adjusted-β = 0.371, 95% CI (0.134–0.608), p = 0.002] and direct bilirubin (DB) [adjusted-β = 0.411, 95% CI (0.300–0.522), p < 0.001). Mediation analysis demonstrated a direct protective role of preadmission statins treatment (β = − 0.024, p < 0.01), TB (β = − 0.003, p < 0.05) and DB (β = − 0.009, p < 0.05). Furthermore, it was found that TB (4.0%) and DB (12.0%) mediated the relationship between preadmission statins therapy and MACE. Bilirubin has a protective effect against MACE. In patients with normal bilirubin level undergoing elective PCI, preadmission statin use elevated bilirubin levels, which were independently associated with a lower incidence of MACE over the long-term follow-up period.