If $r_k(n)$ is the number of representations of $n$ as a sum of $k$ squares, and $k\geq 5$, then it is known that the estimate
$\sum_{n \leq X}r_k(n)=C_k X^{\frac{k}{2}}+O(X^{\frac{k}{2}-1}\log{x})$X^{\frac{k}{2}}+O(X^{\frac{k}{2}-1})$
is known, and for $k\geq 4$ this is best possible, because $r_k(n) \neq O(n^{\frac{k}{2}-1})$ for $k\geq 4$ fixedo(n^{\frac{k}{2}-1})$.

