In Maria Icaza's Ohio State PhD thesis (1992?) she established the following result. For any positive integer $n$, let $S(n)$ be the set of $\mathbb Z$-lattices (or integral quadratic forms, if one prefers polynomials) that can be represented by some sums of squares. Then there exists an integer $g(n)$ such that all lattices in $S(n)$ are represented by $g(n)$ number of squares. She also obtained an explicit upper bound on $g(n)$, which is certainly not optimal. All of these were published later in a couple of papers which you can find in MathSciNet.
Precise values of $g(n)$ are known up to $n = 6$. For $n \leq 5$, $g(n) = n + 3$. However, $g(6) = 10$ which was proved by M-H Kim and B-K Oh in the 90's (in Journal of Number Theory). Later they obtained much better upper bounds for $g(n)$ in a series of papers.