Molecular doping has been proven to be an effective approach to adjusting the electronic structure of polymeric carbon nitride (PCN) and thus improving its optical properties and photocatalytic activity. Herein, theobromine, a compound composed of an
imidazole ring and a pyrimidine ring, was first copolymerized with urea to prepared doped PCN. Experimental investigations and theoretical calculations indicate that, a narrowing in band gap and a positive shift in valence band positon happened to the theobromine doped PCN, owing to the synergistic effect between the pyrimidine ring and the imidazole ring in the theobromine molecule. Moreover, it is shown that the doping with theobromine at a suitable mass fraction makes the obtained sample exhibit decreased photoluminescent emission, enhanced photocurrent density, and reduced charge-transport resistance. Consequently, an enhancement in the photocatalytic activity for water oxidation is found for the sample, which oxygen evolution rate is 4.43 times higher than that of the undoped PCN. This work sheds light on the choice of the molecular dopants for PCN to improve its photocatalytic performance.