The following theorem and example give (partial) answers. By an $n$-manifold we understand a Hausdorff space whose any point has a neighborhood, homeomorphic to an open subspace of $\mathbb R^n_+=\{(x_1,\dots,x_n)\in\mathbb R^n:x_n\ge 0\}$.
Theorem. For each 1-manifold $M$ the boundary $\partial M$ is a deformation retract of some open set $U\subseteq M$ that contains $\partial M$.
Proof. By the definition of a 1-manifold, for every $x\in\partial M$ there exists a neighborhood $U_x\subseteq M$, homeomorphic to $[0,1)$. Fix a homeomorphism $h_x:U_x\to[0,1)$ such that $h_x(x)=0$. It can be shown that for distinct $x,y\in\partial M$ the sets $U_x,U_y$ are disjoint. Then $U=\bigcup_{x\in \partial M}U_x$ is an open neighborhood of $\partial M$ and the function $H:U\times [0,1]\to U$, $H:(u,t)=h_x^{-1}(t\cdot h_x(u))$ where $u\in U_x$, is a deformation retraction of $U$ onto $\partial M$.
Example. There exists a separable 2-manifold $M$ whose boundary $\partial M$ is homeomorphic to $\mathbb R\times\mathfrak c$. Being non-separable, the boundary $\partial M$ cannot be a retract of a (necessarily separable) neighborhood $U$ of $\partial M$ in $M$.
This example is described by Peter Nyikos as Example 3.6 of his survey paper "The theory of nonmetrizable manifolds" in the Handbook of Set-Theoretic Topology.