We construct analytical charged anti-de Sitter (AdS) black holes surrounded by perfect fluids in four dimensional Rastall gravity. Then, we discuss the thermodynamics and phase transitions of charged AdS black holes immersed in regular matter like dust and radiation, or exotic matter like quintessence, Λ CDM type, and phantom fields. Surrounded by phantom field, the charged AdS black hole demonstrates a new phenomenon of reentrant phase transition (RPT) when the parameters Q , N p , and ψ satisfy some certain condition, along with the usual small/large black hole (SBH/LBH) phase transition for the surrounding dust, radiation, quintessence, and cosmological constant fields.