Ag3PO4 nanoparticles were doped by different lanthanides (Gd, Dy and Er). Response surface methodology was utilized for optimizing photocatalytic processes. Considerable enhancement in photocatalytic activity was obtained by Dy-doped Ag3PO4. h+h+ and O2·− were the main reactive species photocatalytic degradation of RB19.