Soil organic carbon (SOC) is the key to soil fertility and quality. However, SOC has severely declined in the past several decades due in part to inappropriate nitrogen (N) and phosphorus (P) input levels. Thus far, the influences of N and P input levels on the accrual of different SOC fractions and relevant microbial traits at aggregate scales remain uncertain. Here, a 3-year field experiment was used to reveal the effects of N and P input levels on SOC fractions in a Mollisol. Treatments included straw return (SR) and combinations of high nitrogen (N) and high phosphorus (P) inputs (N + P + SR), high N and low P inputs (N + P1/2 + SR), and low N and high P inputs (N1/2 + P + SR). Macroaggregates (>0.25 mm), microaggregates (0.25–0.053 mm), and clay and silt (<0.053 mm) were separated, and then particulate organic carbon (POC) and mineral-associated organic carbon (MOC) were determined after aggregate density fractionation. C-cycling genes (cbhI, GH48 and cbbL genes) were quantified by quantitative PCR, and aggregate bacterial community compositions were analyzed by amplicon sequencing of the 16S rRNA genes. The results showed that the free POC (fPOC) content increased after SR, and SR with N input (irrespective of N level) increased bacterial C-cycling gene abundance (GH48 and cbbL genes) and MOC content; however, only combinations with high N inputs increased the fungal cbhI gene abundance and occluded POC (oPOC) content, while P input levels had little impact on SOC fractions. Structural equation modelling revealed that pH was a determinant of GH48 and cbbL gene abundances, which were positively associated with MOC, while N:P was positively related to cbhI gene abundance and oPOC. Network analysis revealed that SOC fractions increased with Nitrosomonadaceae, Xanthobacteraceae, Gaiellaceae and Subgroup_6 and decreased with Gemmataceae and Betaproteobacteriales, suggesting a functional role in SOC sequestration. Our study suggests that moderate high N input and reduced P input can promote the accrual of SOC fractions in a Mollisol with straw return.