Protein functions are largely affected by their conformations. This is exemplified in proteins containing modular domains. However, the evolutionary dynamics that define and adapt the conformation of such modular proteins remain elusive. Here we show that cis-interactions between the C-terminal phosphotyrosines and SH2 domain within the protein tyrosine phosphatase Shp2 can be tuned by an adaptor protein, Grb2. The competitiveness of two phosphotyrosines, namely pY542 and pY580, for cis-interaction with the same SH2 domain is governed by an antagonistic combination of contextual amino acid sequence and position of the phosphotyrosines. Specifically, pY580 with the combination of a favourable position and an adverse sequence has an overall advantage over pY542. Swapping the sequences of pY542 and pY580 results in one dominant form of cis-interaction and subsequently inhibits the trans-regulation by Grb2. Thus, the antagonistic combination of sequence and position may serve as a basic design principle for proteins with tunable conformations.