Here’s an outline to get you started. Let $U$ be a proper open subset of $X$, and let $d$ be the given metric on $X$. Define
$f:U\to\Bbb R:x\mapsto\frac1{d(x,X\setminus U)}\;,$
and show that $f$ is continuous. Now define
$\rho:U\times U\to\Bbb R:\langle x,y\rangle\mapsto d(x,y)+|f(x)-f(y)|\;,$
and show that $\rho$ is a metric on $U$ that generates the same topology as $d$. Then show that $\langle U,\rho\rangle$ is complete.
The intuitive idea is that we want to kill off Cauchy sequences in $U$ whose limits are not in $U$; $f(x)$ is large when $x$ is close to the boundary of $U$, so adding the extra $|f(x)-f(y)|$ term stretches the metric and keeps sequences converging to points outside of $U$ from being $\rho$-Cauchy.