  We present improved constraints on the coupling of ultralight bosonic dark
matter to photons based on long-term measurements of two optical frequency
ratios. In these optical clock comparisons, we relate the frequency of the
${}^2S_{1/2} (F=0)\leftrightarrow {}^2F_{7/2} (F=3)$ electric-octupole (E3)
transition in $^{171}$Yb$^{+}$ to that of the ${}^2S_{1/2} (F=0)\leftrightarrow
\,{}^2D_{3/2} (F=2)$ electric-quadrupole (E2) transition of the same ion, and
to that of the ${}^1S_0\leftrightarrow\,{}^3P_0$ transition in $^{87}$Sr.
Measurements of the first frequency ratio $\nu_\textrm{E3}/\nu_\textrm{E2}$ are
performed via interleaved interrogation of both transitions in a single ion.
The comparison of the single-ion clock based on the E3 transition with a
strontium optical lattice clock yields the second frequency ratio
$\nu_\textrm{E3}/\nu_\textrm{Sr}$. By constraining oscillations of the
fine-structure constant $\alpha$ with these measurement results, we improve
existing bounds on the scalar coupling $d_e$ of ultralight dark matter to
photons for dark matter masses in the range of about $
10^{-24}-10^{-17}\,\textrm{eV}/c^2$. These results constitute an improvement by
more than an order of magnitude over previous investigations for most of this
range. We also use the repeated measurements of
$\nu_\textrm{E3}/\nu_\textrm{E2}$ to improve existing limits on a linear
temporal drift of $\alpha$ and its coupling to gravity.
