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.

Edit2: To clarify further the question.

There are two variants of the questions. For both we suppose $A$ is a closed equivalence relation, $d:A\to \mathbb{R}_+$ continuous and satisfies the metric hypothesis.

Q1: Does there exists an extension $d:X\times X\to \mathbb{R}_+$ which is continuous and a metric.

Q2: Does there exists an extension $d:X\times X\to \mathbb{R}_+$ which is a metric and defines the topology on $X$.

Remark that if $X$ is compact Q1 and Q2 are the same.

Q2 is false without further hypothesis on $d$. The further hypothesis is as follows. Since $X$ is metrizable, it can be equipped with the notion of Cauchy sequence (depends on the choice of a metric). The additional hypothesis is that there exists a metric on $X$ such that if $x_n$ is a sequence with $(x_n,x_m)\in A$ for all $n,m$, then $x_n$ is Cauchy for the metric on $X$ if and only if it is Cauchy for the metric $d:A\to \mathbb{R}_+$.

I am interested in both Q1 and Q2.

3more comments