Multifunctional BaGdF5 nanospheres with mesoporous, luminescent, and magnetic properties have been successfully synthesized with the assistance of trisodium citrate by a hydrothermal method. The mesoporous structure is revealed by scanning electron microscope and transmission electron microscope images as well as N2 adsorption–desorption isotherm. The as-synthesized BaGdF5 nanospheres exhibit an intense broad bluish emission (centered at 450 nm) under the excitation of 390 nm, which might originate from the CO2·– radical-related defect produced by Cit3– groups. It is also shown that these BaGdF5 nanospheres brightened the T1-weighted images, suggesting that they could act as T1 contrast agents for magnetic resonance imaging. Using metformin hydrochloride as the model drug, the luminescent porous spheres show good drug storage/release capability. Furthermore, the emission intensity varies as a function of the cumulative drug release, making the drug-carrying system easily trackable and monitorable by detec...