Developing high-performance catalysts for direct synthesis of hydrogen peroxide (H2O2; DSHP) remains challenging. The paper proposes a strategy to optimize Pd catalysts by enriching Ni-modified N-doped porous carbon. The theoretical studies indicate that Ni modulates the electronic structure of Pd through charge transfer and strain effects, effectively reducing the adsorption energy of reaction intermediates. Furthermore, the Crystal Orbital Hamilton Population (COHP) analysis demonstrated that the energy-integrated COHP (ICOHP) of the OO bonds in O2* (* denotes the adsorbed state), OOH*, and HOOH* were positively correlated with dissociation activation energies and negatively correlated with hydrogenation activation energies. The modulation of the electronic structure of Pd by Ni reduces the hydrogenation activation energies of O2* and OOH* and increases the dissociation activation energies of O2*, OOH*, and HOOH*, thereby enhancing the selectivity and productivity of H2O2. The experimental results aligned with the theoretical predictions, showcasing that the optimized Pd-Ni7.5/NPCs catalyst exhibited remarkable H2O2 selectivity and productivity of 70.5 % and 230.31 mol kgcat-1·h-1, respectively, surpassing the performance of Pd/NPCs (47.1 % and 52.3 mol kgcat-1·h-1). This study offers profound insights into the crucial role of electron effects in DSHP using nickel-modified palladium catalysts, providing strong evidence into the design and optimization of Pd catalysts.