Inter-personal affiliations and coalitions are an important part of politicians’ behaviour, but are often difficult to observe. Since an increasing amount of political communication now occurs online, data from online interactions may offer a new toolkit to study ties between politicians; however, the methods by which robust insights can be derived from online data require further development, especially around the dynamics of political social networks. We develop a novel method for tracking the evolution of community structures, referred to as ‘multiplex community affiliation clustering’ (MCAC), and use it to study the online social networks of Members of Parliament (MPs) and Members of the European Parliament (MEPs) in the United Kingdom. Social interaction networks are derived from social media (Twitter) communication over an eventful 17-month period spanning the UK General Election in 2015 and the UK Referendum on membership of the European Union in 2016. We find that the social network structure linking MPs and MEPs evolves over time, with distinct communities forming and re-forming, driven by party affiliations and political events. Without including any information about time in our model, we nevertheless find that the evolving social network structure shows multiple persistent and recurring states of affiliation between politicians, which align with content states derived from topic analysis of tweet text. These findings show that the dominant state of partisan segregation can be challenged by major political events, ideology, and intra-party tension that transcend party affiliations.