Royden’s Proposition 35 in Section 7.9 is true, but his argument is seriously flawed. The heart of the argument is his Proposition 34, which is essentially this:
Proposition: Let $Y$ be a subset of a topological space $X$, and let $f:Y\to M$ be a continuous map into a complete metric space $(M,d)$. Then $f$ may be extended to a continuous function $\overline f:G\to M$, where $G$ is a $G_\delta$-set in $X$ and $Y \subseteq G$.
His proof seems to be seriously incomplete, in that it requires more than just filling in details; I can’t see any way to make it work without the additional assumption that $Y$ is dense in some $G_\delta$-set in $X$. (In fact it’s false as stated: see below.) In that case one can argue as in the proof of Kuratowski’s result: if $Y$ is a dense subset of $A$, a $G_\delta$ in $X$, the set $G = \{x\in A: \operatorname{osc}_f(x)=0\}$ is also a $G_\delta$ in $X$, and $f$ extends to $G$. In particular, if $Y$ is dense in $X$ we may take $A$ to be $X$ itself. (In this version it’s Theorem 4.3.20 in Engelking.) Fortunately, this is enough to give the desired result.
Theorem: Let $Y$ be a dense subset of a Hausdorff space $X$, and let $h:Y\to M$ be a homeomorphism of $Y$ onto a complete metric space $M$. Then $Y$ is a $G_\delta$-set in $X$.
Proof: Since $Y$ is dense in $X$, the corrected version of the proposition ensures that there are a $G_\delta$-set $G\supseteq Y$ and a continuous $\overline h:G\to M$ extending $h$. Let $f = h^{-1}\circ \overline h:G\to Y$, and let $g = \operatorname{id}_G:G\to G$; clearly $f \upharpoonright Y = g\upharpoonright Y = \operatorname{id}_Y$. The range $G$ is Hausdorff, so $f$ and $g$ agree on a closed subset of $G$ and hence on $G \cap \operatorname{cl}Y = G$. But then $f = g$, so $Y = \operatorname{ran}f = \operatorname{ran}g = G$, and $Y$ is therefore a $G_\delta$ in $X$.
Royden correctly requires $X$ to be Hausdorff, but apparently for the wrong reason: judging by his Exercise 8.30, to which he refers at this point, he thinks that he needs the domain of $f$ and $g$ to be Hausdorff to ensure that they’re identical, rather than the range. Here’s the exercise in question:
Let $A \subset B \subset \overline A$ be subsets of a Hausdorff space, and let $f$ and $g$ be two continuous maps of $B$ into a topological space $X$ with $f(u) = g(u)$ for all $u \in A$. Then $f \equiv g$.
Of course this is false, as may be seen by taking $A = \omega$, $B = \omega+1$, $X = \{0,1\}$ with non-empty open sets $\{0\}$ and $X$, $f$ the constant $0$ function on $\omega+1$, and $g$ the characteristic function of $\{\omega\}$ in $\omega+1$.
To see that Royden’s Proposition 34 is false as stated, let $D$ be a set of power $\omega_1$, and let $p$ and $q$ be two points not in $D$. Let $X = D \cup \{p,q\}$, and topologize $X$ as follows: points of $D$ are isolated, and the basic open nbhds of $p$ ($q$, resp.) are the sets of the form $\{p\} \cup (D \setminus C)$ ($\{q\} \cup (D \setminus C)$, resp.), where $C$ is any countable subset of $D$. Let $Y = \{p,q\}$. Let $M = \{0,1\}$ as a subspace of $\mathbb{R}$ with the usual metric, and define $f:Y\to M$ by $f(p) = 0$ and $f(q) = 1$. Then $f$ is a homeomorphism, but $p$ and $q$ don’t have disjoint nbhds in any $G_\delta$ containing both of them, so $f$ has no continuous extension to such a $G_\delta$.