The most general result is - I believe - Schmüdgen's Positivstellensatz, which applies to all compact basic semi-algebraic sets. It says that every (strictly) positive polynomial function on a compact basic semi-algebraic set is equal to a sum of squares.

Konrad Schmüdgen, The $K$-moment problem for compact semi-algebraic sets, Math. Ann. 289 (1991), no. 2, 203–206.