The escalating demand for rare earth elements (REEs) highlights the necessity for their sustainable recovery from waste streams and secondary resources. However, this process requires materials with exceptional selectivity and capacity for REEs due to their low concentration and high presence of interfering ions. Herein, we synthesized zeolitic imidazolate framework-8 (ZIF-8) and subsequently modified it with tributyl phosphate (TBP) to enhance its affinity and selectivity for the recovery of REEs. The distribution coefficients ( K d ) of ZIF-8-TBP for REEs (neodymium, Nd, and dysprosium, Dy) were orders of magnitude higher than the K d of main interfering ions (e.g., Mg, Ni Al, and Fe). Particularly, the maximum sorption capacities ( q m ) for Nd and Dy were 475 and 529 mg g −1 , respectively. In addition, the separation factor between Dy (a representative of heavy REE) and Nd (a representative of light REE) reached 24, greatly exceeding the figures reported previously. Importantly, the outstanding ability of ZIF-8-TBP for selective separation and recovery of REEs was demonstrated via its application to real samples including mining wastewater, and leaching solutions from REE filter cakes and discarded NdFeB magnets. Multiscale simulations reveal that ZIF-8-TBP possessed a stronger binding strength and greater sorption energy for REE ions. These results indicate that ZIF-8-TBP could effectively harvest REEs from wastes and offers an efficient alternative for industrial applications in REE recovery.