Phosphates with rich structural diversities and novel physicochemical properties can be regarded as the indispensible sources of optical functional materials. Therefore, the extensive research has been performed to search the suitable nonlinear optical (NLO) materials and unveil the relationship among the crystal structures, properties and functions of phosphates system. Herein, two pyrophosphates, namely, Na4P2O7 and β-Ca2P2O7 have been obtained and characterized. Results show that the two title compounds can achieve the coexistence of deep-ultraviolet (UV) cutoff edges (<190 nm) and observable second harmonic generation (SHG) effects (0.2 × and 0.5 × KH2PO4 (KDP)). Besides, the positive roles of alkaline and alkaline earth metals with larger radii or higher ratios of M/P2O7 on SHG effects of pyrophosphates can be concluded. Theoretical analysis reveals that their NLO effects mainly originate from O-2p and P-2p orbitals near to the Fermi level. In addition, their thermal properties, infrared spectra and elemental analysis were also discussed.