An oxygen sensor used in cell culture was constructed by immobilizing fluorophore in PEGDA-based membrane through in situ photografting technology. This technology allows for the grafting sensitive membranes, such as analyte-sensitive hydrogels and enzyme immobilized layers, directly from the negative-tone photoresist SU-8 surface with spatial control, even within completed microfluidic channels. The detection principle of this oxygen sensor was based on the dynamic quenching of the luminescence of a Ruthenium complex to dissolved oxygen. General principles of sensor optimization are presented. These include issues such as fluorophore concentration, thickness control of the membranes and sensitivity enhancement. The characteristic of the oxygen sensor has also been studied here in details, such as production stability, long-term stability and response time. The particular advantages conferred by the use of in situ photografting technology are emphasized. Based on the good results achieved, a fluorescent glucose biosensor incorporating glucose oxidase and the Ruthenium complex in PEGDA membrane was also constructed and tested.