3. Let the function $f(x)=\frac{(x+1)^{2}+\sin x}{x^{2}+1}$ have the maximum value and minimum value as $M$ and $N$, respectively. Then $M+N=$
3. 2 .

From the given information, we have
$$
f(x)=\frac{(x+1)^{2}+\sin x}{x^{2}+1}=1+\frac{2 x+\sin x}{x^{2}+1} \text {. }
$$

Notice that the function $g(x)=\frac{2 x+\sin x}{x^{2}+1}$ is an odd function. Therefore, the maximum value $M_{0}$ and the minimum value $N_{0}$ of $g(x)$ satisfy
$$
\begin{array}{l}
M_{0}+N_{0}=0 . \\
\text { Also, } M=M_{0}+1, N=N_{0}+1 \Rightarrow M+N=2 .
\end{array}
$$