We calculate the amplitude of the rare flavour-changing neutral-current decay $Bto piell^+ell^-$ at large recoil of the pion. The nonlocal contributions in which the weak effective operators are combined with the electromagnetic lepton-pair emission are systematically taken into account. These amplitudes are calculated at off-shell values of the lepton-pair mass squared, $q^2<0$, employing the operator-product expansion, QCD factorization and light-cone sum rules. The results are fitted to hadronic dispersion relations in $q^2$, including the intermediate vector meson contributions. The dispersion relations are then used in the physical region $q^2>0$. Our main result is the process-dependent addition $Delta C^{(Bpi)}_9(q^2)$ to the Wilson coefficient $C_9$ obtained at $4m_ell^2<q^2lesssim m_{J/psi}^2$. Together with the $Bto pi$ form factors from light-cone sum rules, this quantity is used to predict the differential rate, direct CP-asymmetry and isospin asymmetry in $Bto piell^+ell^-$. We also estimate the total rate of the rare decay $Bto pi ubar{ u}$.