Photocatalysis may provide an intriguing approach to nitrogen fixation, which relies on the transfer of photoexcited electrons to the ultrastable N≡N bond. Upon N2 chemisorption at active sites (e.g., surface defects), the N2 molecules have yet to receive energetic electrons toward efficient activation and dissociation, often forming a bottleneck. Herein, we report that the bottleneck can be well tackled by refining the defect states in photocatalysts via doping. As a proof of concept, W18O49 ultrathin nanowires are employed as a model material for subtle Mo doping, in which the coordinatively unsaturated (CUS) metal atoms with oxygen defects serve as the sites for N2 chemisorption and electron transfer. The doped low-valence Mo species play multiple roles in facilitating N2 activation and dissociation by refining the defect states of W18O49: (1) polarizing the chemisorbed N2 molecules and facilitating the electron transfer from CUS sites to N2 adsorbates, which enables the N≡N bond to be more feasible for dissociation through proton coupling; (2) elevating defect-band center toward the Fermi level, which preserves the energy of photoexcited electrons for N2 reduction. As a result, the 1 mol % Mo-doped W18O49 sample achieves an ammonia production rate of 195.5 μmol gcat-1 h-1, 7-fold higher than that of pristine W18O49. In pure water, the catalyst demonstrates an apparent quantum efficiency of 0.33% at 400 nm and a solar-to-ammonia efficiency of 0.028% under simulated AM 1.5 G light irradiation. This work provides fresh insights into the design of photocatalyst lattice for N2 fixation and reaffirms the versatility of subtle electronic structure modulation in tuning catalytic activity.