Fabrication of durable materials with excellent oil adsorption capacity and separation performance for the treatment of oily wastewater is meaningful based on smart responsiveness. Herein, a solvent-responsive melamine sponge (MS) was developed via silanization followed by the in-situ growth of zeolitic imidazolate framework-8 (ZIF-8). Detailed characterization of the resultant composite MS was conducted using scanning electron microscopy (SEM), energy dispersive spectrometer (EDS), X-ray diffraction (XRD), and Fourier transform infrared spectroscopy (FTIR). The multiscale hierarchical MS substrate exhibited highly hydrophobic property in the pH range of 1-11, along with a satisfactory adsorption capacity in the range of 65.4-134.2 g/g for different oils. The modified surface transformed from superhydrophobicity/superlipophilicity to superhydrophilicity/underwater superoleophobicity upon ethanol wetting, reverting to its original superhydrophobic state upon drying. The separation flux of the MS substrate was above 1.5×104L/m2h for both oil and water removal, along with the separation efficiency more than 98.7%. No obvious changes of the separation performance after 50 successive immiscible oil/water separation indicated the excellent durability and robustness of the anchored ZIF-8 nanoparticles on the surface of modified MS substrate. More importantly, oil-in-water emulsion separation was successfully carried out via the ZIF-8 MS composite with a high separation efficiency over 99.1%. The developed smart sponge with high oil absorption capacity, excellent chemical stability and fire resistance exhibited a wide range of potential practical applications in the convenient treatment of oily wastewater.