Microbes often form densely populated communities, which favor competitive and cooperative interactions. Cooperation among bacteria often occurs through the production of metabolically costly molecules produced by certain individuals that become available to other neighboring individuals, called public goods. This type of cooperation is susceptible to exploitation, since non-producers of a public good can benefit from it while saving the cost of its production (cheating), gaining a fitness advantage over producers (cooperators). Thus, in mixed cultures, cheaters can increase in frequency in the population, relative to cooperators. Sometimes, and as predicted by simple game-theoretic arguments, such increase in the frequency of cheaters causes loss of the cooperative traits by exhaustion of the public goods, eventually leading to a collapse of the entire population. In other cases, however, both cooperators and cheaters remain in coexistence. This raises the question of how cooperation is maintained in microbial populations. Several strategies to prevent cheating have been described involving a single trait and a unique environmental constraint. In this review, we describe current knowledge on the evolutionary stability of microbial cooperation, discussing recent discoveries describing the mechanisms operating in multiple traits and multiple constraints settings. We conclude with a consideration of the consequences of these complex interactions, and we briefly discuss the potential role of social interactions involving multiple traits and multiple environmental constraints in the evolution of specialization and division of labor in microbes.