A highly sensitive and selective optical membrane for determination of Hg2+ and Pb2+ was prepared by covalent immobilization of dithizone on agarose membrane. In addition to its high stability, reproducibility and relatively long lifetime, the proposed optical sensor revealed good selectivity for target ions over a large number of alkali, alkaline earth, transition, and heavy metal ions. The proposed optical membrane displays linear responses from 1.1 × 10−8 to 2.0 × 10−6 mol L−1 and 1.2 × 10−8 to 2.4 × 10−6 mol L−1 for Hg2+ and Pb2+, respectively. The limits of detection (LOD) were 2.0 × 10−9 mol L−1 and 4.0 × 10−9 mol L−1 for Hg2+and Pb2, respectively. The prepared optical membrane was successfully applied to the determination of Hg2+ and Pb2+ in industrial wastes, spiked tap water and natural waters without any preconcentration step.