We have developed a general method for controlling molecular functions using a photodegradable hydrogel; gels containing molecules made from such materials are capable of release and activation by light stimulus. As the elimination of molecular leaching from the gel before irradiation was a barrier to the precise control of molecular function, we optimized the monomer used in gel preparation during this study. The addition of N,N′-methylenebis(acrylamide) (MBAA) inhibited molecular leaching from the gel; the MBAA concentration is a critical factor in controlling the leaching of encapsulated molecules. We succeeded in preparing a gel that halved the leaching of small encapsulated molecules, while the leaching of large molecules, such as albumin (66 kDa) and ferritin (450 kDa), was at negligible levels, or disappeared. The on/off ratios (released amount/leached amount) of albumin and ferritin were 8 and 17, respectively.