Sulfonated-silica-coated cobalt ferrite (CoFe2O4) magnetic nanoparticles (MNPs-SiCoFe-SO3H) are efficient heterogeneous catalysts for the synthesis of 3,4-dihydropyrimidin-2(1H)-one and octahydroquinazoline derivatives in the absence of solvent. The effects of solvent, temperature, and catalyst amount on the reaction are investigated. The easy separation, reusability of the catalyst, simplicity of the procedure, mild reaction conditions, and good yields (68–95%) within short reaction times (15–70 min) are the advantages of this method. The catalyst can be reused up to eight times with not much loss of activity. Scanning electron microscopy images, X-ray diffraction spectra, and elemental analysis of the recycled catalyst show that the catalyst is stable after the reaction.