Abstract Herein we present a new viologen‐based radical‐containing metal–organic framework (RMOF) Gd‐IHEP‐7, which upon heating in air undergoes a single‐crystal‐to‐single‐crystal transformation to generate Gd‐IHEP‐8. Both RMOFs exhibit excellent air and water stability as a result of favorable radical‐radical interactions, and their long‐lifetime radicals result in wide spectral absorption in the range 200–2500 nm. Gd‐IHEP‐7 and Gd‐IHEP‐8 show excellent activity toward solar‐driven nitrogen fixation, with ammonia production rates of 128 and 220 μmol h −1 g −1 , respectively. Experiments and theoretical calculations indicate that both RMOFs have similar nitrogen fixation pathways. The enhanced catalytic efficiency of Gd‐IHEP‐8 versus Gd‐IHEP‐7 is attributed to intermediates stabilized by enhanced hydrogen bonding.