When is the closure of a path connected set also path connected?

Here's something that I came up with. The proposition below is what you're asking for but I've also encapsulated the main idea behind these results in the following lemma in case that's more helpful.

Lemma: Let $S \subseteq X$ be path-connected and $x^1 \in \overline{S}$. Suppose there exists a countable decreasing (i.e. $U_{i+1} \subseteq U_i$) neighborhood basis $\left( U_i \right)_{i=1}^{\infty}$ in $X$ at $x^1$ such that for each $i$, whenever $s^i \in S \cap U_i$ then there exists a path in $S \cap U_i$ from $s^i$ to some element of $S \cap U_{i+1}$. Then $S \cup \left\lbrace x^1 \right\rbrace$ is path-connected.

Remark: Note that we are not assuming that for all $i$, there exists a path between any two point of $S \cap U_i$. The sets $S \cap U_i$ need not even be connected so this is weaker than requiring local connectivity of $\overline{S}$ at $x^1$.

Corollary: Let $S \subseteq X$ be path-connected. If the condition of the above lemma is satisfied at each $x^1 \in \overline{S}$ (or slightly more generally, if each path-component of the boundary of $S$ contains some point satisfying this condition) then $\overline{S}$ is path-connected.

Prop: Let $S \subseteq X$ be path-connected. Suppose that each path component of $\overline{S} \setminus S$ contains some $x^1$ for which there exists a countable decreasing neighborhood basis $\left( U_i \right)_{i=1}^{\infty}$ in $X$ at $x^1$ s.t. for each $i$ and each path-component $P_i$ of $S \cap U_i$, there exists a path in $\overline{S} \cap U_i$ whose image intersects both $P_i$ and $S \cap U_{i+1}$. Then $\overline{S}$ is path-connected.

Remark: In this proposition, you can replace "of $\overline{S} \setminus S$" with "of the boundary of $S$ in $\overline{S}$". Also, to prove that $\overline{S}$ is path-connected, it may be easier to find some other path-connected $R \subseteq X$ such that $\overline{R} = \overline{S}$ and then apply these results to $R$ in place of $S$.

Proof of lemma: Pick any $s^1 \in S \cap U_1$ and any $0 = t_0 < t_1 < \cdots < 1$ s.t. $t_i \to 1$ and let $\gamma_0 : [t_0, t_1] \to S$ be the constant path at $s^0 := s^1$. Suppose for all $0 \leq l \leq i + 1$ we've picked $s^l \in S \cap U_l$ and for every $0 \leq l \leq i$ we have a path $\gamma_l : [t_l, t_{l+1}] \to S \cap U_l$ from $s^l$ to $s^{l+1}$ (where observe that this holds for $i = 0$). By assumption, we can pick $s^{i+2} \in S \cap U_{i+2}$ and a path $\gamma_{i+1} : [t_{i+1}, t_{i+2}] \to S \cap U_{i+1}$ from $s^{i+1}$ to $s^{i+2}$.

After starting this inductive construction at $i = 0$ we can use $\gamma_0, \gamma_1, \ldots$ to define $\gamma : [0, 1] \to S \cup \left\lbrace x^1 \right\rbrace$ on $[0, 1)$ in the obvious way and then declare that $\gamma(1) := x^1$. For any integer $N$, $l \geq N$ implies $\operatorname{Im} \gamma_l \subseteq U_l \subseteq U_N$ so that $\gamma([t_N, 1]) \subseteq U_N$. Thus $\gamma$ is continuous at $1$ so that $S \cup \left\lbrace x^1 \right\rbrace$ is path-connected. Q.E.D.

It should now be clear how the idea behind this lemma's proof led to the above proposition's statement.

Proof of prop: Let $x^1$ and $\left( U_i \right)_{i=1}^{\infty}$ have the properties described in the proposition's statement, let $0 = t_0 < t_1 < \cdots < 1$ be s.t. $t_i \to 1$, and let $\gamma_0 : [t_0, t_1] \to S \cap U_1$ be any constant path. Suppose $i \geq 0$ is such that for all $1 \leq l \leq i$, we have constructed a path $\gamma_l : \left[ t_l, t_{l+1} \right] \to \overline{S} \cap U_l$ such that $\gamma_l(t_l) = \gamma_{l-1}\left( t_{l} \right)$ and $\gamma_l\left( t_{l+1} \right) \in S \cap U_{l+1}$ (note that this is true for $i = 0$). Our assumption on $\left( U_i \right)_{i=1}^{\infty}$ allows us to construct a path $\gamma_{i+1} : \left[ t_{i+1}, t_{i+2} \right] \to \overline{S} \cap U_{i+1}$ starting that $\gamma_i\left( t_{i+1} \right)$ and ending at some point of $S \cap U_{i+2}$. Exactly as was done in the proof of the above lemma, we may now define a continuous map $\gamma : [0, 1] \to \overline{S}$ such that $\gamma(1) = x^1$. Q.E.D.