The spaces in which every closed set is a boundary are precisely the resolvable spaces. A topological space is said to be resolvable if it can be partitioned into two dense subspaces.
$\mathbf{Proposition}$ A space is resolvable if and only if every closed set is the boundary of some set.
$\leftarrow$ If $X$ is a topological space such that every closed subspace of $X$ is a boundary of some set, then the set $X$ is the boundary of some set $A$. However, if
$X=\partial A=\overline{A}\setminus(A^{\circ})$, then $A^{\circ}=\emptyset$, so
$\overline{A^{c}}=(A^{\circ})^{c}=X$. Therefore $A$ and $A^{c}$ are two disjoint dense subsets of $X$, so $X$ is resolvable.
$\rightarrow$ Suppose that $X$ is resolvable. Then there is a partition $A,B$ of $X$ into two dense subspaces. Let $C\subseteq X$ be a closed subspace. Then
I claim that $C=\partial (\partial C\cup(C^{\circ}\cap A))$.
Clearly $\partial C\cup(C^{\circ}\cap A)\subseteq C$, so
$\overline{\partial C\cup(C^{\circ}\cap A)}\subseteq C$.
Clearly $\partial C\subseteq\overline{\partial C\cup(C^{\circ}\cap A)}$.
On the other hand, if $x\in C^{\circ}$, then for each open neighborhood $U$ of $x$, the set $U\cap C^{\circ}$ is also an open neighborhood of $x$. Therefore the set $A\cap U\cap C^{\circ}$ is non-empty since $A$ is a dense set. We therefore conclude that $x\in\overline{C^{\circ}\cap A}\subseteq\overline{\partial C\cup(C^{\circ}\cap A)}$. We therefore conclude that $C^{\circ}\subseteq\overline{\partial C\cup(C^{\circ}\cap A)}$. Therefore, we have
$C=C^{\circ}\cup\partial C\subseteq\overline{\partial C\cup(C^{\circ}\cap A)}$.
Therefore $C=\overline{\partial C\cup(C^{\circ}\cap A)}$.
On the other hand, if $U\subseteq\partial C\cup(C^{\circ}\cap A)$ is open, then $U\subseteq C^{\circ}\cap A$. However, since $B$ is dense, $U$ must be empty. Therefore, $(\partial C\cup(C^{\circ}\cap A))^{\circ}=\emptyset$.
We conclude that $C=\partial(\partial C\cup(C^{\circ}\cap A))$. $\mathbf{QED}$
As was pointed out by Will Sawin, a closed subset of a topological space is a boundary of some space if and only if its interior is resolvable.
Since the notion of resolvability has not appeared on this website before, let me state a few facts about resolvability.
Most spaces with no isolated points that one deals with in topology are resolvable (and much more ).
Let's call a space $X$ $\kappa$-resolvable if $X$ can be partitioned into $\kappa$ many dense subsets. The dispersion character $\Delta(X)$ of a topological space $X$ is the minimal cardinality of a non-empty open subspace of $X$. A topological space $X$ is said to be maximally resolvable if it is $\Delta(X)$-resolvable.
Every compact Hausdorff space and every metric space is maximally resolvable. Furthermore, assuming $V=L$, there every Baire space with no isolated points is $\aleph_{0}$-resolvable. In fact, the existence of a Baire irresolvable space with no isolated points is equiconsistent with the existence of a measurable cardinal. Also, every countably compact regular space is $\omega_{1}$-resolvable.
Also, resolvability is equivalent to a seemingly weaker condition. A space $X$ is resolvable if and only if it can be partitioned into finitely many subsets with empty interiors.