Biofilms are communities of microbial cells that are encapsulated within a self-produced polymeric matrix. The matrix is critical to the success of biofilms in diverse habitats; however, many details of the composition, structure, and function remain enigmatic. Biofilms formed by the Gram-positive bacteriumBacillus subtilisdepend on the production of the secreted film-forming protein BslA. Here, we show that a gradient of electron acceptor availability through the depth of the biofilm gives rise to two distinct functional roles for BslA and that these roles can be genetically separated through targeted amino acid substitutions. We establish that monomeric BslA is necessary and sufficient to give rise to complex biofilm architecture, whereas dimerization of BslA is required to render the community hydrophobic. Dimerization of BslA, mediated by disulfide bond formation, depends on two conserved cysteine residues located in the C-terminal region. Our findings demonstrate that bacteria have evolved multiple uses for limited elements in the matrix, allowing for alternative responses in a complex, changing environment.