Bose-Einstein correlations between identified charged pions are measured for p+Pb collisions at sNN=5.02TeV using data recorded by the ATLAS detector at the CERN Large Hadron Collider corresponding to a total integrated luminosity of 28nb-1. Pions are identified using ionization energy loss measured in the pixel detector. Two-particle correlation functions and the extracted source radii are presented as a function of collision centrality as well as the average transverse momentum (kT) and rapidity (yππ) of the pair. Pairs are selected with a rapidity -2<yππ<1 and with an average transverse momentum 0.1<kT<0.8GeV. The effect of jet fragmentation on the two-particle correlation function is studied, and a method using opposite-charge pair data to constrain its contributions to the measured correlations is described. The measured source sizes are substantially larger in more central collisions and are observed to decrease with increasing pair kT. A correlation of the radii with the local charged-particle density is demonstrated. The scaling of the extracted radii with the mean number of participating nucleons is also used to compare a selection of initial-geometry models. The cross term Rol is measured as a function of rapidity, and a nonzero value is observed with 5.1σ combined significance for -1<yππ<1 in the most central events.