This is false for a general field $k$. It is true for some special fields, like finite fields.
Counterexample: Take $k = \mathbb C((t))$, $E$ an elliptic curve over $\mathbb C$ base-changed to $\mathbb C((t))$, $r=1$. Because we're over $\mathbb C$, the twists don't matter and can be ignored.
$H^2(\overline{E}, \mathbb Q_\ell) =\mathbb Q_\ell$ and so its Galois-invariants are one-dimensional. However, we'll show the left side is three-dimensional.
The Galois group of $\mathbb C((t))$ is $\hat{\mathbb Z}$, so the Hochschild-Serre spectral sequence (which exists because the torsion etale cohomology groups in this setting are finite, so usual etale cohomology agrees with continuous etale cohomology, which has Hochschild-Serre) $$ H^p ( \mathbb C((t)), H^q( \overline{E}, \mathbb Q_\ell )) \to H^{p+q} ( E, \mathbb Q_\ell)$$ is nontrivial only for $p=0,1$, $q= 0,1,2$. Because the Galois action on the cohomology groups is trivial, we will have $\dim H^{0,0} = \dim H^{1,0}=1, \dim H^{0,1}= \dim H^{1,1}=2, \dim H^{0,2} = \dim H^{1,2} =2$. There are no possible nonvanishing differentials, and so $\dim H^2 =2 + 1 = 3$.
Over finite fields, we again have finite torsion cohomology groups and thus a Hochschild-Serre sequence. We again have cohomology only for $p=0,1$, but now the Tate twist does play a role, and the Galois action on cohomology is nontrivial.
$H^0 ( \mathbb F_q, V)$ is only nontrivial when the eigenvalues of Frobenius acting on $V$ include $1$. Since $H^q (\overline{X}, \mathbb Q_\ell(r)) $ is pure of weight $q-2r$, this can happen only for $q=2r$. Again there are no possible nontrivial differentials, but now the only group that contributions to $H^{2r} (X, \mathbb Q_\ell(r))$ is $p=0, q=2r$, which indeed is $H^{2r}(\overline{X}, \mathbb Q_\ell(r))^{\operatorname{Gal}(\mathbb F_q)}$.
For number fields $K$, it fails for $r=1$, $X$ a point. This may be what gdchtf meant.
In this case, the right side vanishes and the left side is the inverse limit of $H^2 ( K , \mathbb Z/\ell^n (1))$ as $n$ goes to $\infty$.
By Brauer theory, say for $\ell$ odd, this torsion cohomology group is the set of finitely supported $\mathbb Z/\ell^n$-valued functions on the set of finite places of $K$ which sum to $0$.
The inverse limit would be $\mathbb Z_\ell$-valued functions on the set of finite places whose sum converges to $0$ in the $\ell$-adic topology. (For the sum to converge at all, there must be only finitely many terms nonzero mod $\ell^n$ for each $n$.)
Inverting $\ell$, we get $\mathbb Q_\ell$-valued functions on the set of finite places whose sum converges to $0$.
This vector space is infinite-dimensional and does not vanish.