The exploitation and employment of agricultural waste in polluted water treatment is one of the most important cost-effective approaches. Therefore, a novel mesoporous spongy adsorbent/photocatalyst was successfully synthesized through the grafting of nickel and cobalt oxides nanocomposites with wheat straw-derived SiO2. Nickel and cobalt oxides were added to enhance the functionality of wheat straw-derived SiO2. This synthesis methodology presents a simplistic, cost-effective, and eco-approachable alternative to getting an adsorbent and photocatalyst for the adsorption and photocatalytic degradation of methylene blue (MB) pollutants from wastewater. The modified wheat straw-derived SiO2 (MWSS) was characterized via XRD, SEM, EDX, TGA, FTIR, and nitrogen adsorption. Molecular dynamics computational calculations were performed to comprehend the ability of methylene blue to adjust the WSDS surface. The experiments of adsorption and photodegradation trials were performed to optimize the pH, contact time, initial MB-concentration, and temperature parameters. Furthermore, kinetics and isotherm models were checked to explain the MB-removal mechanism using mesoporous spongy MWSS. The current work indicated that the mesoporous MWSS adsorbent/photocatalyst provided efficient adsorption capability (79%), significant photocatalytic performance (93%), and higher solidity during reusability as well. This study suggests an efficient composite that contributes to getting rid of the MB pollutants from wastewater.