We present a search for gravitational waves from 116 known millisecond and young pulsars using data from the fifth science run of the LIGO detectors. For this search ephemerides overlapping the run period were obtained for all pulsars using radio and X-ray observations. We demonstrate an updated search method that allows for small uncertainties in the pulsar phase parameters to be included in the search. We report no signal detection from any of the targets and therefore interpret our results as upper limits on the gravitational wave signal strength. The most interesting limits are those for young pulsars. We present updated limits on gravitational radiation from the Crab pulsar, where the measured limit is now a factor of seven below the spin-down limit. This limits the power radiated via gravitational waves to be less than ~2% of the available spin-down power. For the X-ray pulsar J0537-6910 we reach the spin-down limit under the assumption that any gravitational wave signal from it stays phase locked to the X-ray pulses over timing glitches, and for pulsars J1913+1011 and J1952+3252 we are only a factor of a few above the spin-down limit. Of the recycled millisecond pulsars several of the measured upper limits are only about an order of magnitude above their spin-down limits. For these our best (lowest) upper limit on gravitational wave amplitude is 2.3x10^-26 for J1603-7202 and our best (lowest) limit on the inferred pulsar ellipticity is 7.0x10^-8 for J2124-3358.