Let's assume $X$ is locally compact Hausdorff, so that $\hat X$ is compact Hausdorff and you can indeed use $C(\hat X,Y)$. 

If the inclusion $i:C_c(X,Y)\to C(\hat X, Y)$ is a homotopy equivalence for all $Y$, in particular for $\hat X$, then the identity map $\hat X\to \hat X$ is based homotopic to a map that takes a neighborhood of $\infty$ to $\infty$. 

(This fails, for example, if $X$ is $\mathbb Z$, or $\mathbb Z\times \mathbb R$, or any ``surface of infinite genus'', because in these cases $X$ has arbitrarily small neighborhoods of infinity $N$ such that the homology of $(X,N)$ is finitely generated, while the homology of $\hat X$ is not. But if $X$ is the interior of a compact manifold with boundary, then using a collar you get what you want.)

Conversely, if there is a homotopy of the identity as above then by composing with it you get at least half of what you want: a right homotopy inverse of that inclusion $i$.