Lagrange's four squares theorem is a classical theorem in number theory. Recently, Z.-W. Sun found that it can be further refined in various ways. In this paper we study some conjectures of Sun and obtain various refinements of Lagrange's theorem. We show that any nonnegative integer can be written as $x^2+y^2+z^2+w^2$ $(x,y,z,w\in\mathbb Z)$ with $x+y+z+w$ (or $x+y+z+2w$, or $x+2y+3z+w$) a square (or a cube). Also, every $n=0,1,2,\ldots$ can be represented by $x^2+y^2+z^2+w^2$ $(x,y,z,w\in\mathbb Z)$ with $x+y+3z$ (or $x+2y+3z$) a square (or a cube), and each $n=0,1,2,\ldots$ can be written as $x^2+y^2+z^2+w^2$ $(x,y,z,w\in\mathbb Z)$ with $(10w+5x)^2+(12y+36z)^2$ (or $x^2y^2+9y^2z^2+9z^2x^2$) a square. We also provide an advance on the 1-3-5 conjecture of Sun. Our main results are proved by a new approach involving Euler's four-square identity