An extended version of the standard pion-nucleus optical potential is presented using the momentum-space formulation of the multiple scattering theory. This potential is used for studying the influence of nonlocal effects and nuclear structure on the characteristics of light pionic atoms. A method is suggested to treat the long-range two-nucleon correlations involved in the second order optical potential. Particularly, the spin-orbital Fermi motion correction to the first-order optical potential, the center-of-mass correlations, and the spin-isospin corrections to the second-order optical potential are discussed in some detail. The results are presented in comparison with the experimental data for the 1s and 2p levels of light pionic atoms up to Ca44.