Sand production is a common problem that interrupts hydrocarbon production from unconsolidated formations. Different chemical and mechanical methods are used to prevent solid production either by consolidating the sand particles or installing downhole screens. This study presents a novel approach for sand consolidation using enforced calcium and magnesium precipitation. The used chemicals are ammonium hydrogen fluoride, calcium oxide, and magnesium oxide solutions. In this work, different measurements were carried out to assess the performance of the new consolidation method. Also, the impact of soaking the consolidated sand in freshwater, toluene, and HCl was examined. The rock mineralogy was determined before and after each soaking treatment using X-ray diffraction (XRD) analysis. The nuclear magnetic resonance (NMR) technique was used to evaluate the pore system at different stages. In addition, scanning electron microscope (SEM) technique was used to examine the morphology and chemistry changes after each chemical treatment. Finally, the rock strength was measured before and after the treatment using a scratch test. Results indicate that the proposed chemical method can significantly improve the sand consolidation and increase the rock strength to 34 MPa (4931 psi). Soaking the consolidated sand sample in water and toluene showed minor alterations in the rock properties. However, using HCl lead to increasing rock permeability due to mineral dissolution. The strength measurements showed that the consolidated sand can withstand the water and toluene treatment, and the rock strength was reduced by less than 10%. Overall, a new chemical treatment is presented to improve the sand consolidated utilizing enforced calcium and magnesium precipitation. The consolidated sand sample showed very reasonable rock strength which can prevent sand migration.