In a supersymmetric extension of the standard model where baryon and lepton numbers are local gauge symmetries(BLMSSM) and the Yukawa couplings between Higgs doublets and exotic quarks are considered, we study the one loop diagrams and the two-loop Barr-Zee type diagrams with a closed Fermi(scalar) loop between the vector Boson and Higgs. Using the effective Lagrangian method, we deduce the Wilson coefficients of dimension 6 operators contributing to the anomalous magnetic moment of muon, which satisfies the electromagnetic gauge invariance. In the numerical analysis, we consider the experiment constraints from Higgs and neutrino data. In some parameter space, the new physics contribution is large and even reaches 24 × 10 −10 , which can remedy the deviation well.