Heteroatom-doped carbon materials have high gravimetric potassium-ion storage capability because of their abundant active sites and defects. However, their practical applications toward potassium storage are limited by sluggish reaction kinetics and short cycling life owing to the large ionic radius of K+ and undesirable parasitic reactions. Herein, we report a new strategy that allows for bottom-up patterning of thin N/P co-doped carbon layers with a uniform mesoporous structure on two-dimensional graphene sheets. The highly porous architecture and N/P co-doping properties provide abundant active sites for K+, and the graphene sheets promote charge/electron transfer. This synergistic structure enables excellent K+ storage performance in terms of specific capacity (387.6 mAh g-1 at 0.05 A g-1), rate capability (over 5 A g-1), and cycling stability (70% after 3,000 cycles). As a proof of concept, a potassium-ion capacitor assembled using this carbon anode yields a high energy density of 107 Wh kg-1, a maximum power density of 18.3 kW kg-1, and ultra-long cycling stability over 40,000 cycles.