6.164. $\sqrt{x+8+2 \sqrt{x+7}}+\sqrt{x+1-\sqrt{x+7}}=4$.
Solution.

Let $\sqrt{x+7}=y \geq 0, x+7=y^{2}, x=y^{2}-7$.

With respect to $y$, the equation takes the form

$$
\begin{aligned}
& \sqrt{y^{2}+2 y+1}+\sqrt{y^{2}-y-6}=4, \sqrt{(y+1)^{2}}+\sqrt{y^{2}-y-6}=4 \\
& |y+1|+\sqrt{y^{2}-y-6}=4
\end{aligned}
$$

Since $y \geq 0$, we have $y+1+\sqrt{y^{2}-y-6}=4, \sqrt{y^{2}-y-6}=3-y$, where $3-y \geq 0, y \leq 3$. Squaring both sides of the equation, we get $y^{2}-y-6=9-6 y+y^{2}, y=3$. Then $\sqrt{x+7}=3, x+7=9, x=2$.

Answer: $x=2$.