  We present predictions for the photon energy spectrum in inclusive $B\to
X_s\gamma$ decays mediated by the electromagnetic penguin operator $O_7$ to
N$^3$LL$'$. We use soft-collinear effective theory (SCET) to resum the singular
contributions in the peak region at large photon energy. In the tail region the
resummed predictions are matched to fixed order at N$^3$LO, where we include
the known fixed-order contributions for $O_7$ up to $\mathcal{O}(\alpha_s^2)$.
We develop a method to suitably parametrize the still unknown
$\mathcal{O}(\alpha_s^3)$ nonsingular corrections in terms of theory nuisance
parameters, whose variations provide an estimate of the associated theory
uncertainty. In this context, we also study different ways to treat
higher-order cross terms in the matching. Another important aspect of our
analysis is the short-distance scheme used for the $b$-quark mass $m_b$. We
find that in the present context, the 1$S$ mass scheme, which was previously
used up to 2-loop order, fails to work at 3-loop order, because the mass scheme
enters at a soft scale much smaller than $m_b$ here, for which the 1$S$ scheme
was not devised. Using instead the MSR mass scheme with $R\sim
1\,\mathrm{GeV}$, we obtain stable results with good perturbative convergence
up to N$^3$LL$'$.
