Let me solve the case of compact $Y$. Thus $Y$ is a contractible ANR. Then Y is an AR.
Indeed, the equivalence "contractible ANR $\Leftrightarrow$ AR" is a well known theorem, certainly known in the past to the founder of the theory of ANRs, Karol Borsuk. To prove this equivalence, consider an arbitrary compact metric space $X$, its closed subset $A$, and an arbitrary continuous map $f : A \rightarrow Y$, where $Y$ is a contractible ANR. Let $H:Y\times[0;1]\rightarrow Y$ be a contraction to a point $p\in Y$, meaning that $H(y\ 0)=p$ and $H(y\ 1)=y$ for every $y\in Y$. Now we get the constant map $g_0:X\rightarrow Y$, such that $\forall_{x\in X}\ g_0(x)=p$, and a homotopy $\Phi : A\times [0;1]\rightarrow Y$ defined by: $$\forall_{a\in A}\forall_{t\in [0;1]}\quad \Phi(a\ t) := H(f(a)\ t)$$ Observe that $\forall_{a\in A}\ \ g_0(a)=\Phi(a\ 0)$. Thus by the Borsuk homotopy extension theorem there exists a homotopy $F:X\times [0;1]\rightarrow Y$ such that
- $\forall_{x\in X}\quad F(x\ 0)=g_0(x)$ (the value is $p$, of course)
- $\forall_{a\in A}\forall_{t\in [0;1]}\quad F(a\ t) = \Phi(a\ t)$
Now define $g_1:X\rightarrow Y$ by $\forall_{x\in X}\ \ g_1(x) := F(x\ 1)$. Then $g_1$ is a continuous extension of $f:A\rightarrow Y$ onto $X$. Thus we have proven that $Y$ is an AR.
It follows that $Y$ is a retract of the whole $R^n$. \mathbf R^n$. Indeed, space $Y$--being an AR--is a retract of a cube $Q := [-\alpha;\alpha]^n$ which contains $Y$, while cube $Q$ is a retract of $R^n$.\mathbf R^n$.
REMARK The last argument was simple, correct and adequate but ad hoc. Here is a more basic (general) argument: let compact $Y\subseteq \mathbf R^n$ be and AR (for metric compact spaces). The Euclidean space $\mathbf R^n$ is a subspace of a metric compact space $C$ (e.g. of $\mathbf R^n\cup{\infty} = \mathbf S^n$), and $Y$ is a retract of $C$, hence $Y$ is a retract of $\mathbf R^n$.

