The overall density decreases as the universe expands, but so does the critical density. Specifically, one of the Friedmann equations can be written as
$$
\dot{a}^2 -\frac{8\pi G}{3}\rho a^2= -kc^2,
$$
where the scale factor $a(t)$ describes the expansion of the universe, $\rho$ is the total mass density (radiation, baryonic matter, dark matter, and dark energy) and the constant integer $k$ can have the values $k = 1$, $0$ or $-1$ for positive, zero, or negative curvature respectively. We can rewrite this as
$$
H^2\left(1 - \frac{\rho}{\rho_\text{c}}\right) = -\frac{kc^2}{a^2},\tag{1}
$$
with $H(t) = \dot{a}/a$ the Hubble parameter and
$$
\rho_\text{c}(t) = \frac{3H^2(t)}{8\pi G}
$$
the critical density. So $\rho_\text{c} \sim H^2$. Since $k$ is a constant, the sign of the curvature of the universe cannot change. For a flat universe, $k=0$ and $\rho \equiv \rho_\text{c}$ at all times.
What happens if the universe is not flat? For this, we need to know how $H(t)$ changes over time. The present day corresponds with $a=1$, so that
$$
H_0^2\left(1 - \frac{\rho_0}{\rho_\text{c,0}}\right) = -kc^2,
$$
and therefore
$$
H^2\left(1 - \frac{\rho}{\rho_\text{c}}\right) = H_0^2\left(1 - \frac{\rho_0}{\rho_\text{c,0}}\right)a^{-2},
$$
which can be written in terms of the radiation, matter, and dark energy densities as
$$
H^2\left(1 - \Omega_{R} - \Omega_{M} - \Omega_{\Lambda}\right) =
H_0^2\left(1 - \Omega_{R,0} - \Omega_{M,0} - \Omega_{\Lambda,0}\right)a^{-2}.
$$
I will assume a cosmological constant dark energy. Using the shorthand notation $\Omega_{K}= 1 - \Omega_{R} - \Omega_{M} - \Omega_{\Lambda}$, the equation takes the form
$$
H^2\,\Omega_{K} = H_0^2\,\Omega_{K,0}\,a^{-2}.\tag{2}
$$
A flat universe corresponds with $\Omega_{K} = 0$. Since
$$\begin{align}
\Omega_{R} &= \frac{\rho_{R}}{\rho_{c}} = \frac{\rho_{c,0}}{\rho_{c}}\frac{\rho_{R,0}\,a^{-4}}{\rho_{c,0}} = \frac{H_0^2}{H^2}\Omega_{R,0}\,a^{-4}\\
\Omega_{M} &= \frac{\rho_{M}}{\rho_{c}} = \frac{\rho_{c,0}}{\rho_{c}}\frac{\rho_{M,0}\,a^{-3}}{\rho_{c,0}} = \frac{H_0^2}{H^2}\Omega_{M,0}\,a^{-3}\\
\Omega_{\Lambda} &= \frac{\rho_{\Lambda}}{\rho_{c}} = \frac{\rho_{c,0}}{\rho_{c}}\frac{\rho_{\Lambda}}{\rho_{c,0}} = \frac{H_0^2}{H^2}\Omega_{\Lambda,0},
\end{align}
$$
we can solve equation (2) for $H^2$:
$$
H^2 = H_0^2\left(\Omega_{R,0}\,a^{-4} + \Omega_{M,0}\,a^{-3} + \Omega_{K,0}\,a^{-2} + \Omega_{\Lambda,0}\right),
$$
so that
$$
\Omega_{K} = \frac{\Omega_{K,0}\,a^{-2}}{\Omega_{R,0}\,a^{-4} + \Omega_{M,0}\,a^{-3} + \Omega_{K,0}\,a^{-2} + \Omega_{\Lambda,0}}.
$$
This has two remarkable consequences:
At early times, $a\rightarrow 0$, and
$$
\Omega_{K} \approx \frac{\Omega_{K,0}}{\Omega_{R,0}}a^2 \rightarrow 0.
$$
In other words, the early universe must have been very nearly flat. This is known as the flatness problem, and is one of the motivations for inflation theory.
At late times, $a\rightarrow \infty$, and
$$
\Omega_{K} \approx \frac{\Omega_{K,0}}{\Omega_{\Lambda,0}}a^{-2} \rightarrow 0,
$$
so dark energy is actually pushing the universe towards a flat geometry (again).
Conclusion: the geometry of the universe is either exactly flat and will remain so, or is becoming more and more flat because of dark energy.