Solution (source code)

= Solution

Let $h:Y\to\mathbb R$ be <continuous>, without a boundedness assumption. The <homeomorphism> $\theta(t)=t/(1+|t|)$ maps the <real line> onto $(-1,1)$, with inverse $\theta^{-1}(s)=s/(1-|s|)$. The <bounded function> $g=\theta\circ h$ extends by the preceding bounded construction to a <continuous> real-valued $G$ on $X$. Since $|G|<1$ on $Y$, the strict-range modification gives a <continuous> $\widetilde G$ with range in $(-1,1)$ and the same restriction to $Y$. Therefore
$$
\boxed{H(x)=\frac{\widetilde G(x)}{1-|\widetilde G(x)|}}
$$
is <continuous> everywhere: its denominator is pointwise positive. On $Y$ it equals $\theta^{-1}(\theta(h))=h$. Thus \b[$Y$ is $C$-embedded]. It is important to modify the extension before applying the inverse: an extension allowed to attain $1$ or $-1$ outside $Y$ would make this formula undefined there.