With the theorem of Lavrentiev you can prove the following:
Let $X$ be a completely metrizable space and $A\subseteq X$. If $f:A\longrightarrow A$ is a homeomorphism then $f$ can be extended to a homeomorphism $h:H\longrightarrow H$, where $H\supseteq A$ is a $G_{\delta}$ set.
Thinking about it I came to the following problem:
Let $X$ be a completely metrizable space and $A,B\subseteq X$ such that $A\cap B=\varnothing$. If $f:A\longrightarrow B$ is a homeomorphism then $f$ can be extended to a homeomorphism $h:H\longrightarrow H$, where $H\supseteq A,B$ is a $G_{\delta}$ set?.
No. Let $X=A\cup B$ where $A=\{0\}\times \Bbb R$ and $B=\{(x^{-1},x^{-1}\sin (x^{-1})):0<x\in \Bbb R\},$ with the Cartesian metric $d.$
$X$ is a closed subspace of the complete metric space $(\Bbb R^2,d)$ so $(X,d)$ is a complete metric space.
Note that $A$ is closed in $\Bbb R^2$ so $A$ is closed in the space $X$. Note also that $B$ is dense in $X$.
Now $A$ and $B$ are each homeomorphic to $\Bbb R$ so let $f:A\to B$ be a homeomorphism.
Suppose $f$ could be extended to a homeomorhism $h:H\to H'$ where $H$ and $H'$ are subsets of $X,$ and $H\supset A\cup B.$ Since $X=A\cup B,$ this requires $H=X.$ And $h$ maps $A$ onto $B$ so $h$ must map $B$ into $A.$ Now $(0,1)\in Cl_X (B)=Cl_H(B)$ so by the continuity of $h$ we must have $$f((0,1))=h((0,1))\in Cl_{H'}(h[B])\subset Cl_{H'}(A)\subset Cl_X (A) =A,$$ a contradiction because $f((0,1))\in B$ and $A,B$ are disjoint.
The nub of this is that $B$ is dense and open in $X$, and not empty, while $A,$ the closed complement of $B$ in $X$, is homeomorphic to $B.$