Male color polymorphism may be an important precursor to sympatric speciation by sexual selection, but the processes maintaining such polymorphisms are not well understood. Here, we develop a formal model of the hypothesis that male color polymorphisms may be maintained by variation in the sensory environment resulting in microhabitat-specific selection pressures. We analyze the evolution of two male color morphs when color perception (by females and predators) is dependent on the microhabitat in which natural and sexual selection occur. We find that an environment of heterogeneous microhabitats can lead to the maintenance of color polymorphism despite asymmetries in the strengths of natural and sexual selection and in microhabitat proportions. We show that sexual selection alone is sufficient for polymorphism maintenance over a wide range of parameter space, even when female preferences are weak. Polymorphisms can also be maintained by natural selection acting alone, but the conditions for polymorphism maintenance by natural selection will usually be unrealistic for the case of microhabitat variation. Microhabitat variation and sexual selection for conspicuous males may thus provide a situation particularly favorable to the maintenance of male color polymorphisms. These results are important both because of the general insight they provide into a little appreciated mechanism for the maintenance of variation in natural populations and because such variation is an important prerequisite for sympatric speciation.