Photocatalysis has emerged as an effective approach to sustainably convert biomass into value-added products. CoSe2 is a promising non-precious, efficient cocatalyst for photooxidation, which can facilitate the separation of photogenerated electron-holes, increase the reaction rates, and enhance photocatalytic efficiency. In this work, we synthesized a stable and efficient photocatalysis system of CoSe2/g-C3N4 through attaching CoSe2 on g-C3N4 sheets, with a yield of 50.12% for the selective photooxidation of xylose to xylonic acid. Under light illumination, the photogenerated electrons were prone to migrating from g-C3N4 to CoSe2 due to the higher work function of CoSe2, resulting in the accelerated separation of photogenerated electron-holes and the promoted photooxidation. Herein, this study reveals the unique function of CoSe2, which can significantly promote oxygen adsorption, work as an electron sink and accelerate the generation of ·O2- , thereby improving the selectivity toward xylonic acid over other by-products. This work provides useful insights into the design of selective photocatalysts by engineering g-C3N4 for biomass high-value utilization.