In this paper, we complete the nonabelian Hodge theory (NAHT) triangle of isomorphisms for stacks between the Borel-Moore homologies of the Dolbeault, Betti, and de Rham moduli stacks. We first explain how to realise the category of connections on a smooth projective curve as a subcategory of a 2-Calabi-Yau dg-category satisfying some appropriate geometric conditions. Then, we define a cohomological Hall algebra (CoHA) product on the Borel-Moore homology of the stack of connections on a smooth projective curve. This allows us to not only compare the Borel-Moore homologies of the stacks at the relative and absolute levels for the three sides of NAHT, but also to compare their CoHA structures: they all coincide. To compare the Dolbeault and de Rham sides, we define a CoHA for the Hodge-Deligne moduli space parametrising $\lambda$-connections. The Betti and de Rham sides are compared using the (derived) Riemann-Hilbert correspondence. The comparison of the Borel-Moore homologies of the Dolbeault and Betti moduli stacks was previously considered by the author with Davison and Schlegel Mejia (without taking the cohomological Hall algebra structures into account). This paper completes this study and provides a CoHA enhancement of the classical NAHT for curves.