Task switching has been the subject of extensive research, as it offers a valuable window into the dynamics by which cognitive control states interact with each other and are updated in response to shifting contextual demands. Recent work suggests that gating, learning, and performance monitoring mechanisms play key, interrelated roles in the emergence of counterintuitive task switching phenomena such as residual switch costs (Rogers & Monsell, 1995), backward inhibition (Mayr & Keele, 2000), and asymmetrical switch costs (Wylie & Allport, 2000). We introduce a new computational model of these phenomena. Based on Guided Activation Theory (Miller & Cohen, 2001), the model adds gating (Braver & Cohen, 1999), performance monitoring (Botvinick et al., 2001), and learning mechanisms, combining the latter two into a novel Competition-Driven Learning (CDL) rule which is related to Norman et al.’s biologically plausible oscillatory learning rule (2006). CDL uses response conflict to drive inhibitory learning between incompatible task representations, punishing irrelevant, interfering tasks. The model successfully reproduces the above phenomena. Lesions of the model’s gating, learning, and performance monitoring components demonstrate that a simpler model cannot accommodate the same findings equally well. Finally, the model makes novel predictions about task switching, such as the shape of an entire time series of RT distributions, which would not have been testable without an explicit computational model.