4. Given real numbers $x, y, z \in (0, \sqrt{2})$, and satisfying
$$
\left(2-x^{2}\right)\left(2-y^{2}\right)\left(2-z^{2}\right)=x^{2} y^{2} z^{2} \text{. }
$$

Then the maximum value of $x+y+z$ is
4.3.
$$
\begin{array}{l}
\text { Let } x=\sqrt{2} \cos \alpha, y=\sqrt{2} \cos \beta, \\
z=\sqrt{2} \cos \gamma\left(\alpha, \beta, \gamma \in\left(0, \frac{\pi}{2}\right)\right) \text {. }
\end{array}
$$

Then the given equation transforms to
$$
\tan \alpha \cdot \tan \beta \cdot \tan \gamma=1 \text {. }
$$

Assume without loss of generality that $\tan \gamma \geqslant 1$. Then
$$
0<\tan \alpha \cdot \tan \beta \leqslant 1 \text {. }
$$

Since $\tan \alpha \cdot \tan \beta=\frac{1}{\tan \gamma}$, we have
$$
\begin{array}{l}
x+y+z=\sqrt{2}(\cos \alpha+\cos \beta+\cos \gamma) \\
=\sqrt{2}\left(\frac{1}{\sqrt{1+\tan ^{2} \alpha}}+\frac{1}{\sqrt{1+\tan ^{2} \beta}}+\frac{1}{\sqrt{1+\tan ^{2} \gamma}}\right) \\
=\sqrt{2}\left(\frac{\sqrt{1+\tan ^{2} \alpha}+\sqrt{1+\tan ^{2} \beta}}{\sqrt{1+\tan ^{2} \alpha+\tan ^{2} \beta+\tan ^{2} \alpha \cdot \tan ^{2} \beta}}+\frac{1}{\sqrt{1+\tan ^{2} \gamma}}\right) .
\end{array}
$$

Since $\tan ^{2} \alpha+\tan ^{2} \beta \geqslant 2 \tan \alpha \cdot \tan \beta$,
$$
1+\tan ^{2} \gamma \geqslant \frac{1}{2}(1+\tan \gamma)^{2} \text {, }
$$

thus $x+y+z$
$$
\begin{array}{l}
\leqslant \sqrt{2}\left[\sqrt{1+\frac{2}{1+\tan \alpha \cdot \tan \beta}+\frac{1-\tan ^{2} \alpha \cdot \tan ^{2} \beta}{(1+\tan \alpha \cdot \tan \beta)^{2}}}+\frac{\sqrt{2}}{1+\tan \gamma}\right] \\
=\sqrt{2}\left(\sqrt{\frac{4}{1+\tan \alpha \cdot \tan \beta}}+\frac{\sqrt{2}}{1+\tan \gamma}\right) \\
=2\left(\sqrt{\frac{2}{1+\tan \alpha \cdot \tan \beta}}-\frac{1}{1+\tan \alpha \cdot \tan \beta}+1\right) \\
=-2\left(\frac{1}{\sqrt{1+\tan \alpha \cdot \tan \beta}}-\frac{\sqrt{2}}{2}\right)^{2}+3 \leqslant 3 .
\end{array}
$$

Equality holds if and only if $\alpha=\beta=\gamma=45^{\circ}$, i.e., $x=y=z=1$, in which case $(x+y+z)_{\text {max }}=3$.