Nitrogen-doped HG featuring a hierarchical macro- and nanoporous 3-D architecture with high pyrrolic-N content is a promising candidate for the construction of sensitive graphene-based electrochemical sensors for environmental and bioanalytical applications. • N-doped HG featuring a hierarchical macro- and nanoporous 3-D architecture for determination of MP was fabricated. • Pyrrolic-N in N-HG played a key role in enhanced electrocatalysis. • First principle calculations indicated that pyrrolic-N exhibited the strongest MP adsorption. • N-HG with a high pyrrolic-N content exhibited excellent sensing performance. • Ultra-low detection and excellent recovery in case of real samples were achieved. The determination of organophosphorus pesticide (OPS) residues is of great importance in reducing environmental pollution and ensuring food safety. A high-performance nitrogen-doped holey graphene (N-HG) electrochemical sensor for determination of methyl parathion (MP; one of the most commonly used OPS) based on a hierarchical macro- and nanoporous 3-D architecture has been successfully developed. The influence of various N-configurations on electron transfer kinetics and the sensing performance of the N-HG modified electrode was investigated systematically through combined practical and theoretical studies. Three N-bonding configurations were investigated in N-HG, namely, pyridinic N, pyrrolic N, and graphitic N. It was found that N-HG with a high pyrrolic-N content exhibited the largest electron transfer rate and the best sensing performance (ultralow detection limits: 3.5 pg·ml −1 ; wide linear range: 1 ng ml −1 –150 μg·ml −1 ), indicating that pyrrolic-N in the N-HG played a critical role in the electrochemical process and in enhanced electrocatalysis, as confirmed by first-principle calculations. Furthermore, the N-HG based sensor exhibited excellent selectivity and freedom from interference, good accuracy and satisfactory recoveries for real samples, confirming N-HG based electrochemical sensors have great scope for applications in environmental analysis and bio-sensing.