We study magnetic black holes in Einstein’ gravity with negative cosmological constant coupled to rational nonlinear electrodynamics in the background of perfect fluid dark matter (PFDM). The thermodynamics and phase transitions in expanded phase space are investigated. We obtain the black hole metric function, its asymptotic and analyse the horizon radiuses. It was shown that black holes can have one or two horizons. The first law of black hole thermodynamics and Smarr’s relation are proven. We calculate the magnetic potential and conjugates to PFDM parameter and coupling. The specific heat and Gibbs’s free energy are computed and plotted. We evaluate critical specific volumes, critical temperatures and pressures. There are corrections to the critical ratio 3/8 of Van der Waals fluid. The phase transitions and their dependence on the dark matter parameter are analysed. We observe a van der Waals-like behaviour of isotherms, first-order and second-order phase transitions.