Reprogramming gene expression is an essential component of adaptation to changing environmental conditions. In bacteria, a widespread mechanism involves alternative sigma factors that redirect transcription toward specific regulons. The activity of sigma factors is often regulated through sequestration by cognate anti-sigma factors; however, for most systems, it is not known how the activity of the anti-sigma factor is controlled to release the sigma factor. Recently, the general stress response sigma factor in Alphaproteobacteria, σ
EcfG
, was identified. σ
EcfG
is inactivated by the anti-sigma factor NepR, which is itself regulated by the response regulator PhyR. This key regulator sequesters NepR upon phosphorylation of its PhyR receiver domain via its σ
EcfG
sigma factor-like output domain (PhyR
SL
). To understand the molecular basis of the PhyR-mediated partner-switching mechanism, we solved the structure of the PhyR
SL
–NepR complex using NMR. The complex reveals an unprecedented anti-sigma factor binding mode: upon PhyR
SL
binding, NepR forms two helices that extend over the surface of the PhyR
SL
subdomains. Homology modeling and comparative analysis of NepR, PhyR
SL
, and σ
EcfG
mutants indicate that NepR contacts both proteins with the same determinants, showing sigma factor mimicry at the atomic level. A lower density of hydrophobic interactions, together with the absence of specific polar contacts in the σ
EcfG
–NepR complex model, is consistent with the higher affinity of NepR for PhyR compared with σ
EcfG
. Finally, by reconstituting the partner switch in vitro, we demonstrate that the difference in affinity of NepR for its partners is sufficient for the switch to occur.