Separation of xylene isomers is an important process in the chemical industry and there has been considerable interest in developing advanced materials for xylene separation. In this study, we synergize computational screening and machine learning to explore the selective adsorption of p-xylene over o- and m-xylene in metal–organic frameworks (MOFs). First, a large set (4764) of computation-ready experimental MOFs is screened by geometric analysis and molecular simulation. The relationships between MOF structural descriptors (void fraction, volumetric surface area, and largest cavity diameter) and separation performance metrics (adsorption capacity of p-xylene Np-xylene and selectivity of p-xylene over o- and m-xylene Sp/(m+o)) are established. Then two machine-learning methods (back-propagation neural network and decision tree), as well as particle swarm optimization, are utilized to analyze and optimize Np-xylene and Sp/(m+o). The importance of each descriptor for separation is evaluated in six different MOF data sets. In the 100 top-performing MOFs, the pore limiting diameter (PLD) and largest cavity diameter (LCD) are revealed to be key factors governing separation performance. On the basis of the threshold values of Np-xylene > 0.5 mol/kg and Sp/(m+o) > 5, seven top-performing MOFs are identified. By further incorporating framework flexibility, JIVFUQ is predicted to be the best and superior to many reported MOFs in the literature.