Oligosaccharide chains of newly synthesized membrane receptors are trimmed and modified to optimize their trafficking and/or signalling before delivery to the cell surface. For most membrane receptors, the functional significance of oligosaccharide chain modification is unknown. During the maturation of Rh1 rhodopsin, a Drosophila light receptor, the oligosaccharide chain is trimmed extensively. Neither the functional significance of this modification nor the enzymes mediating this process are known. Here, we identify a dmppe (Drosophila metallophosphoesterase) mutant with incomplete deglycosylation of Rh1, and show that the retained oligosaccharide chain does not affect Rh1 localization or signalling. The incomplete deglycosylation, however, renders Rh1 more sensitive to endocytic degradation, and causes morphological and functional defects in photoreceptors of aged dmppe flies. We further demonstrate that the dMPPE protein functions as an Mn(2+)/Zn(2+)-dependent phosphoesterase and mediates in vivo dephosphorylation of α-Man-II. Most importantly, the dephosphorylated α-Man-II is required for the removal of the Rh1 oligosaccharide chain. These observations suggest that the glycosylation status of membrane proteins is controlled through phosphorylation/dephosphorylation, and that MPPE acts as the phosphoesterase in this regulation.