Due to freshwater scarcity in developing countries, irrigating the arable land with wastewater poses potential ecological risks to the environment and food quality. Using cheap soil amendments and foliar application of a newly discovered molecule “melatonin” (ML) can alleviate these effects. The objectives of this pot study were to evaluate the effectiveness of the sole addition of chitosan (CH) and sugar beet factory lime (SBL) in wastewater impacted soil, foliar application of ML, and combining each soil amendment with ML on the heavy metals (HMs) accumulation, growth, nutritional quality and photosynthesis in wheat. Results showed that CH was more effective than SBL for reducing HMs bioavailability in soil, HMs distribution in plants, improving photosynthesis, nutritional quality, and growth. ML application also influenced plant parameters but less than CH and SBL. The CH+ML treatment was the most effective for influencing plant parameters and reducing HMs bioavailability in the soil. Compared to control, CH+ML significantly reduced the concentrations of Pb, Cd, Cr, Ni, Cu, and Co in roots, shoots, and grain up to 89%. We conclude that adding CH+ML in wastewater impacted soils can remediate the soil; reduce HMs concentrations in plants; and improve their photosynthesis, plant growth, grain yield, and nutrition.