Let $X$ be a metrizable topological space, $A\subseteq X\times X$ a nonempty closed subset which is reflexive, symmetric and transitive, $d:A\to \mathbb{R}_+$ a continuous function that satisfies the metric axioms. Does there exist a metric on $X$ which extends $d$ and defines the topology on $X$?
If it makes any difference I can suppose $X$ locally compact second countable.
Edit: As explained in the comments, one needs to add the condition that $d$ defines the topology on $A$. If one restricts to $X$ compact then all such subtleties disappear, and continuity of an extension of $d$ suffices to ensure that it defines the topology.