Deep-red and near-infrared emissive carbon dots (CDs) are highly desired for bioimaging, especially in deep tissue imaging, but they are extremely rare and the known ones usually suffer from low-efficient fluorescence in water and aggregation-induced fluorescence quenching in solid state. In this work, CDs with intriguing solvent-dependent and two-photon fluorescence emissions have been prepared by a facile solvothermal method. Detailed characterizations reveal that there is an n→π* interaction between the carboxyl functional groups on CDs and the electron donor groups in solvent, which leads to the increase of energy density of CDs and the decrease of energy level, resulting in the red shift of luminescence with enhanced electron donating ability of solvent. Inspired by this finding, mesoporous silica nanoparticles (MSNs) with suitable pore size and low biological toxicity are modified by amino groups to confine CDs, thus the deep-red fluorescence emission is achieved both in solid state and in water facilitated by the n→π* interaction of host–guest. The as-prepared CDs@EDA-MSN composite exhibits high-efficient fluorescence with 650 nm wavelength, low toxicity, and good biocompatibility, which endow them a promising application in bio-imaging.