  Let $C$ be an irreducible nonsingular curve over a formally real field $K$
and let $f$ be a regular function which is a sum of squares in the ring of
regular functions of the surface $C \times \mathbb{A}_K$. We show that the (sum
of squares) length of $f$ is the same in the ring of regular functions of $C
\times \mathbb{A}_K$ and in the field of rational functions of $C \times
\mathbb{A}_K$. With this we are able to show that the Pythagoras number of the
ring of regular functions is the same as the Pythagoras number of the field of
rational functions, for some product algebraic surfaces. This shows that the
Pythagoras number of the ring of regular functions of the real plane is 4,
which was not known before.
