The cyclic GMP-AMP synthase (cGAS)/stimulator of interferon gene (STING) signaling pathway plays a critical protective role against viral infections. Metazoan STING undergoes multilayers of regulation to ensure specific signal transduction. However, the mechanisms underlying the regulation of bacterial STING remain unclear. In this study, we determined the crystal structure of anti-parallel dimeric form of bacterial STING, which keeps itself in an inactive state by preventing cyclic dinucleotides access. Conformational transition between inactive and active states of bacterial STINGs provides an on-off switch for downstream signaling. Some bacterial STINGs living in extreme environment contain an insertion sequence, which we show codes for an additional long lid that covers the ligand-binding pocket. This lid helps regulate anti-phage activities. Furthermore, bacterial STING can bind cyclic di-AMP in a triangle-shaped conformation via a more compact ligand-binding pocket, forming spiral-shaped protofibrils and higher-order fibril filaments. Based on the differences between cyclic-dinucleotide recognition, oligomerization, and downstream activation of different bacterial STINGs, we proposed a model to explain structure-function evolution of bacterial STINGs.