The inclusion $\operatorname{Map}(X,A;Y,B)\hookrightarrow \operatorname{Map}(X;Y)$ will be a cofibration whenever $(X,A)$ and $(Y,B)$ are cofibrations, under some mild point-set hypotheses. My argument requires $Y$ to be Hausdorff and $A$ and $X$ to be locally compact Hausdorff (but I'm not sure if these restrictions are necessary).

To begin with, recall that the map given by evaluation $p\colon \operatorname{Map}(X;Y)\to \operatorname{Map}(A;Y)$ is a fibration when $A$ and $X$ are locally compact Hausdorff. This is Theorem 2.8.2 of Spanier's book.

Now it is a result of A. Strøm (Math. Scand. 22 130–142 (1969)) that if $p\colon E\to B$ is a fibration and $C\subseteq B$ is a closed cofibration, then $p^{-1}(C)\subseteq E$ is a cofibration.

To complete the argument, therefore, it suffices to show that $i\colon \operatorname{Map}(A;B)\hookrightarrow\operatorname{Map}(A;Y)$ is a closed cofibration. To see this, use the characterization of cofibrations in terms of retractions of mapping cylinders. We have a retraction $r_Y\colon Y\times I \to Y\times\lbrace 0\rbrace \cup B\times I$. We can use this to define a retraction $\operatorname{Map}(A;Y)\times I \to \operatorname{Map}(A;Y)\times \lbrace 0\rbrace \cup \operatorname{Map}(A;B)\times I$ by setting
$$
(f,t)\mapsto \big( (a\mapsto p_Yr_Y(f(a),t)),p_Ir_Y(f(a),t)\big),
$$
where $p_Y,p_I$ are the projections from the mapping cylinder onto $Y$ and $I$. This shows $i$ is a cofibration; it is closed since $\operatorname{Map}(A;Y)$ is Hausdorff.