5. Given $\angle M O N=40^{\circ}, P$ is a fixed point inside $\angle M O N$, and points $A, B$ move on rays $O M, O N$ respectively. When the perimeter of $\triangle P A B$ is minimized, the value of $\angle A P B$ is ( ).
(A) $80^{\circ}$
(B) $100^{\circ}$
(C) $120^{\circ}$
(D) $140^{\circ}$
5. B.

As shown in Figure 3, construct the symmetric points $C$ and $D$ of point $P$ with respect to lines $O M$ and $O N$, respectively, and connect $C D$, intersecting $O M$ and $O N$ at points $A$ and $B$. At this point, the perimeter of $\triangle P A B$ is minimized.
$$
\begin{array}{l}
\text { Given } P C \perp O M, P D \perp O N \\
\Rightarrow \angle C P D=180^{\circ}-\angle M O N=140^{\circ} \\
\Rightarrow \angle C+\angle D=40^{\circ} \\
\Rightarrow \angle C P A+\angle D P B=40^{\circ} \\
\Rightarrow \angle A P B=100^{\circ} .
\end{array}
$$