This study conducted on the structure of modified acrylamide-based hydrogel by synthesizing the nano composites. The hydrogels employed in this study were provided through a combination of acrylamide monomers, sodium carboxymethyl cellulose (NaCMC) and magnesium oxide (MgO) nanoparticles by crosslinking polymerization. N,N,N',N'-tetramethylethylenediamine and ammonium persulfate as the initiator was applied in the structure of the polymer. Findings of the study considered the nano composites consisting of MgO have the highest swelling ratio compared to pure Aam hydrogels. Thus, MgO is an appropriate nanoparticle to be used in the nano composites. Response surface methodology (RSM) based on a central composite design (CCD Design) was applied to optimize the preparation variables of a hydrogel consisted of MgO, NaCMC. With the swelling ratio for acrylamide-based hydrogel as the response, the effects of two variables, i.e. MgO and NaCMC were investigated. The effects of pH, temperature, MgO, and NaCMC on the drug release were investigated using the CCD design. The predicted appropriate drug release conditions for the hydrogel at the highest rate of temperature (37.50 °C) and pH: 4.10, is at its highest value, while the lower drug release is at temperature 38 °C and pH 3.50. With the desired value of MgO (0.01 g) and amount of NaCMC (0.1 g).