Cyanobacterial mats were hotspots of biogeochemical cycling during the Precambrian. However, mechanisms that controlled O(2)release by these ecosystems are poorly understood. In an analog to Proterozoic coastal ecosystems, the Frasassi sulfidic springs mats, we studied the regulation of oxygenic and sulfide-driven anoxygenic photosynthesis (OP and AP) in versatile cyanobacteria, and interactions with sulfur reducing bacteria (SRB). Using microsensors and stable isotope probing we found that dissolved organic carbon (DOC) released by OP fuels sulfide production, likely by a specialized SRB population. Increased sulfide fluxes were only stimulated after the cyanobacteria switched from AP to OP. O(2)production triggered migration of large sulfur-oxidizing bacteria from the surface to underneath the cyanobacterial layer. The resultant sulfide shield tempered AP and allowed OP to occur for a longer duration over a diel cycle. The lack of cyanobacterial DOC supply to SRB during AP therefore maximized O(2)export. This mechanism is unique to benthic ecosystems because transitions between metabolisms occur on the same time scale as solute transport to functionally distinct layers, with the rearrangement of the system by migration of microorganisms exaggerating the effect. Overall, cyanobacterial versatility disrupts the synergistic relationship between sulfide production and AP, and thus enhances diel O(2)production.