Electronic structure and excited state behavior is of pronounced influence on regulation of nonlinear optical (NLO) response. Herein, a serials of transition metal ions bearing different d‐electron numbers were in situ coordinated within porphyrinic metal‐organic frameworks (MOFs), creating NLO‐responsive M‐metal (metal = Fe, Co, Ni, Cu, and Zn) frameworks. It demonstrated that the NLO properties can be optimized with the increased occupancy of the d‐shell, which enhances the degree of delocalization. Specifically, the full‐filled (d10) electron configuration of Zn2+ stabilizes the electronic structure, combination with π‐π* local excitation character of M‐Zn, promoting charge transfer process and resulting in outstanding NLO properties. Moreover, parameters related to the nonlinear process (β, n2, Imχ(3), Reχ(3) and χ(3)) of M‐Zn are calculated to be higher than those of other materials, consistent with theoretical calculations. This work paves the way for NLO modulation based on electronic analysis and provides a promising approach for constructing high‐performance NLO materials.