In this research, enrichment factor (EF) and pollution load index (PLI) were utilized to estimate the features of enrichment and contamination of PTEs in farmland soil. Furthermore, combining the spatial distribution characteristics of potentially toxic elements (PTEs) and positive matrix factorization (PMF) to distinguish and quantify the sources of PTEs in farmland soil, and then the potential ecological risk (PER) and human health risk (HHR) model based on PMF are applied to quantify the ecological and human health risks from different sources. Taking Puning District as an example, four sources of PTEs in farmland soil were quantitatively allocated. For ecological risk, the study area is at moderate ecological hazard level, and industrial activities were the greatest contributor. The mean E_r^i of Hg were 69.82, reaching medium ecological risk level. For human health risks, both adults and children have no evident non-carcinogenic risk in the study area. And natural source was the largest contributor to non-carcinogenic risk, followed by agricultural activities. With regard to carcinogenic risk, tolerable risks of soil PTEs in the study area were limited not only for adults but also for children. Furthermore, compared with adults, the health risks of children, whether non-carcinogenic or carcinogenic, were higher than those of adults, and the trends in health risks for children and adults were similar. A comprehensive scheme combining source contribution and risk assessment is conducive to quantitatively assess ecological risks, health risks and priority pollution sources, thereupon provide effective suggestions for protecting human health and preventing and controlling pollution.