The production of Υ(nS) mesons (n=1,2,3) in pPb and Pbp collisions at a centre-of-mass energy per nucleon pair sNN=8.16 TeV is measured by the LHCb experiment, using a data sample corresponding to an integrated luminosity of 31.8 nb−1. The Υ(nS) mesons are reconstructed through their decays into two opposite-sign muons. The measurements comprise the differential production cross-sections of the Υ(1S) and Υ(2S) states, their forward-to-backward ratios and nuclear modification factors, performed as a function of the transverse momentum \pt and rapidity in the nucleon-nucleon centre-of-mass frame y∗ of the Υ(nS) states, in the kinematic range pT<25 GeV/c and 1.5<y∗<4.0 (−5.0<y∗<−2.5) for pPb (Pbp) collisions. In addition, production cross-sections for Υ(3S) are measured integrated over phase space and the production ratios between all three Υ(nS) states are determined. The measurements are compared to theoretical predictions and suppressions for quarkonium in pPb collisions are observed.