In this work, we calculate the CP-averaged branching ratios and direct CP-violating asymmetries of the quasi-two-body decays B ðsÞ → Pf 2 ð1270Þ → Pππ with the two-pion distribution amplitude Φ D ππ by using the perturbative QCD factorization approach, where P represents a light pseudoscalar meson K, π, η and η 0. The relativistic Breit-Wigner formula for the D-wave resonance f 2 ð1270Þ is adopted to parameterize the timelike form factor F π , which contains the final state interactions between the pions in the resonant regions. The consistency of theoretical results with data can be achieved by determining the Gegenbauer moments of the D-wave two-pion distribution amplitudes. The decay rates for the considered decay modes are generally in the order of 10 −9 to 10 −6. The integrated direct CP asymmetries for the charged modes agree with the BABAR and Belle measurements. As a by-product, we extract the branching ratios of B ðsÞ → Pf 2 ð1270Þ from the corresponding quasi-two-body decay modes, which still need experimental tests at the ongoing and forthcoming experiments.