Growth of graphitic carbon nitride on mesoporous TiO2 spheres with well-controlled structures was achieved by melt-inﬁltrating dicyandiamide (DICY). The molten DICY diffused into the porous structure of TiO2 , and g-C3 N4 was produced inside the mesopores formed by packing of TiO2 nanoparticles at higher temperature, resulting in a better fused g-C3 N4 -TiO2 heterostructure. The formation of a strong interfacial connection between TiO2 and g-C3 N4 by this preparation method greatly improved the separation efﬁciency of photo-generated electrons and holes. TiO2 /g-C3 N4 composites exhibited much higher photo- catalytic activity than TiO2 and g-C3 N4 towards the degradation of Rhodamine B under both UV light and UV–vis light irradiation. The heterostructured combination provided a synergistic photocatalytic activity through an efﬁcient electron transfer process. Based on the experimental results, a possible mechanism for the improved photocatalytic performance was proposed. The factors affecting the photocatalytic activ- ity were also discussed based on the result of structure analysis, optical and photoelectric characteristics, and photocatalytic reactions.