Carbon-coated mesoporous Co9S8 nanoparticles supported on reduced graphene oxide (rGO) are successfully synthesized by a simple process. This composite makes full use of the protection of the carbon layer on the surface, the good conductivity and three-dimensional (3D) structure of rGO, the mesoporous structure and nanoscale size of Co9S8, thereby presenting the excellent electrochemical performances in potassium-ion batteries, 407.9 mAh·g−1 after 100 cycles at 0.2 A·g−1 and 215.1 mAh·g−1 at 5 A·g−1 in rate performances. After 1,200 cycles at 1.0 A·g−1, this composite still remains a capacity of 210.8 mAh·g−1. The redox reactions for potassium storage are revealed by ex-situ transmission electron microscope (TEM)/high-resolution TEM (HRTEM) images, selected area electron diffraction (SAED) patterns and X-ray photoelectron spectroscopy (XPS) spectra. The application of this composite as the host of sulfur for Li-S batteries is also explored. It sustains a capacity of 431.8 mAh·g−1 after 800 cycles at 3 C, leading to a degradation of 0.052% per cycle. These results confirm the wide applications of this composite for electrochemical energy storage.