No. Take an elliptic curve $X$, and let $p$ be a $3$-torsion point. Then there is a plane model of $X$ as a cubic curve in $\mathbb{P}^2(\mathbb{C})$, such that $p$ is an inflexion point.
If $L$ is the corresponding inflexion line, then $U=X-L = X-\{p\}$ is dense in $X$ and affine (being the complement of a hyperplane section).
Now $X$ and $U$ are non-homeomorphic, for instance because they have non-isomorphic fundamental group; in fact $$\pi_1(X) = \mathbb{Z} \times \mathbb{Z}, \quad \pi_1(U) = \mathbb{Z} \ast \mathbb{Z}.$$