We present a search for gravitational waves from 222 pulsars with rotation frequencies gsim10 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 pulsar's rotation, and 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 1038 kg m2 for the star's moment of inertia, and imply a gravitational-wave-derived upper limit on the star's ellipticity of 1.2 × 10−8. We also place new limits on the emission amplitude at the rotation frequency of the pulsars.