We present a search for gravitational waves from 221 pulsars with rotation frequencies $gtrsim 10$ Hz. We use advanced LIGO data from its first and second observing runs spanning 2015-2017, which provides the highest-sensitivity gravitational-wave data so far obtained. In this search we target emission from both the $l = m = 2$ mass quadrupole mode, with a frequency at twice that of the pulsars rotation, and from the $l = 2$, $m = 1$ mode, with a frequency at the pulsar rotation frequency. The search finds no evidence for gravitational-wave emission from any pulsar at either frequency. For the $l = m = 2$ mode search, we provide updated upper limits on the gravitational-wave amplitude, mass quadrupole moment, and fiducial ellipticity for 167 pulsars, and the first such limits for a further 55. For 20 young pulsars these results give limits that are below those inferred from the pulsars spin-down. For the Crab and Vela pulsars our results constrain gravitational-wave emission to account for less than 0.017% and 0.18% of the spin-down luminosity, respectively. For the recycled millisecond pulsar J0711-6830 our limits are only a factor of 1.3 above the spin-down limit, assuming the canonical value of $10^{38}$ kg m$^2$ for the stars moment of inertia, and imply a gravitational-wave-derived upper limit on the stars ellipticity of $1.2!times!10^{-8}$. We also place new limits on the emission amplitude at the rotation frequency of the pulsars.