The production of charged pions, kaons and (anti)protons has been measured at mid-rapidity ( − 0.5 < y < 0 ) in p–Pb collisions at √sNN = 5.02 TeV using the ALICE detector at the LHC. Exploiting particle identification capabilities at high transverse momentum ( pT ), the previously published pT spectra have been extended to include measurements up to 20 GeV/c for seven event multiplicity classes. The pT spectra for pp collisions at √s = 7 TeV , needed to interpolate a pp reference spectrum, have also been extended up to 20 GeV/c to measure the nuclear modification factor ( RpPb ) in non-single diffractive p–Pb collisions. At intermediate transverse momentum ( 2 < pT < 10 GeV/c ) the proton-to-pion ratio increases with multiplicity in p–Pb collisions, a similar effect is not present in the kaon-to-pion ratio. The pT dependent structure of such increase is qualitatively similar to those observed in pp and heavy-ion collisions. At high pT ( > 10 GeV/c ), the particle ratios are consistent with those reported for pp and Pb–Pb collisions at the LHC energies. At intermediate pT the (anti)proton RpPb shows a Cronin-like enhancement, while pions and kaons show little or no nuclear modification. At high pT the charged pion, kaon and (anti)proton RpPb are consistent with unity within statistical and systematic uncertainties.