Gram-negative bacteria such as Escherichia coli commonly resist β-lactam antibiotics using plasmid-encoded β-lactamase enzymes. Bacterial strains that express β-lactamases have been found to detoxify liquid cultures and thus to protect genetically susceptible strains, constituting a clear laboratory example of social protection. These results are not necessarily general; on solid media, for instance, the rapid bactericidal action of β-lactams largely prevents social protection. Here, we tested the hypothesis that the greater tolerance of biofilm bacteria for β-lactams would facilitate social interactions. We used a recently isolated E. coli strain, capable of strong biofilm formation, to compare how cooperation and exploitation in colony biofilms and broth culture drives the dynamics of a non-conjugative plasmid encoding a clinically important β-lactamase. Susceptible cells in biofilms were tolerant of ampicillin—high doses and several days of exposure were required to kill them. In support of our hypothesis, we found robust social protection of susceptible E. coli in biofilms, despite fine-scale physical separation of resistant and susceptible cells and lower rates of production of extracellular β-lactamase. In contrast, social interactions in broth were restricted to a relatively narrow range of ampicillin doses. Our results show that β-lactam selection pressure on Gram-negative biofilms leads to cooperative resistance characterized by a low equilibrium frequency of resistance plasmids, sufficient to protect all cells.