5. If the function $f(x)=\frac{a+\sin x}{2+\cos x}+b \tan x$ has a sum of its maximum and minimum values equal to 4, then $a+b=$ $\qquad$
5.3.

Given $f(x)=\frac{a+\sin x}{2+\cos x}+b \tan x$ has a maximum or minimum value, we know $b=0$.
Then $y=\frac{a+\sin x}{2+\cos x}$
$$
\begin{array}{l}
\Rightarrow \sin x-y \cos x=a-2 y \\
\Rightarrow \sin (x+\alpha)=\frac{a-2 y}{\sqrt{1+y^{2}}} \\
\Rightarrow|a-2 y| \leqslant \sqrt{1+y^{2}} .
\end{array}
$$

By Vieta's formulas, $\frac{4 a}{3}=4 \Leftrightarrow a=3$.