This study presents an analysis of soil contamination caused by Ni, Zn, Cd, Cu, and Pb at municipal solid waste (MSW) landfills, with a focus on ecological risk assessment. The approach aims to assess how different landfill practices and environmental conditions affect soil contamination with potentially toxic elements (PTEs) and associated environmental risks. Soil samples were collected from MSW landfills in Poland and the Czech Republic. The research included a comprehensive assessment of PTEs in soils in the context of global environmental regulations. The degree of soil contamination by PTEs was assessed using indices: Geoaccumulation Index (Igeo), Single Pollution Index (Pi), Nemerow Pollution Index (PN), and Load Capacity of a Pollutant (PLI). The ecological risk was determined using the Risk of PTEs (ERi) and Sum of Individual Potential Risk Factors (ERI). The maximum values of the indicators observed for the Radiowo landfill were as follows: Igeo = 4.04 for Cd, Pi = 24.80 for Cd, PN = 18.22 for Cd, PLI = 2.66, ERi = 744 for Cd, ERI = 771.80. The maximum values of the indicators observed for the Zdounky landfill were as follows: Igeo = 1.04 for Cu, Pi = 3.10 for Cu, PN = 2.52 for Cu, PLI = 0.27, ERi = 25 for Cd, ERI = 41.86. The soils of the tested landfills were considered to be non-saline, with electrical conductivity (EC) values less than 2,000 μS/cm. Varying levels of PTEs were observed, and geostatistical analysis highlighted hotspots indicating pollution sources. Elevated concentrations of Cd in the soil indicated potential ecological risks. Concentrations of Cu and lead Pb were well below the thresholds set by the environmental legislation in several countries. In addition, Ni concentrations in the soils of both landfills indicated that the average levels were within acceptable limits. Principal Component Analysis (PCA) revealed common sources of PTEs. The identification of specific risk points at the Radiowo and Zdounky sites contributes to a better understanding of potential hazards in landfill environments. By establishing buffer zones and implementing regular maintenance programs, emerging environmental problems can be addressed in a timely manner.