Melamine sponge is widely used in various industrial applications owing to its high specific surface area and excellent mechanical properties. However, its practical use as an oil–water separation material is limited by the complex hydrophobization process and the use of non-renewable additives. Herein, we employed lignin, a wood-based biomass, as an amphiphilic connector to modify melamine foam with alkylated graphene oxide. Lignin was easily coated onto the melamine foam, enhancing its hydrophobicity and allowing for a continuous layer of alkylated graphene oxide. This process considerably improved the hydrophobicity of melamine foam, achieving a contact angle of 132.2°. Consequently, the hydrophobic melamine foam demonstrated selective oil absorption in oil-contaminated environments, with an oil adsorption capacity of 42–158 g/g and an excellent oil absorption efficiency of over 97 % even after 20 cycles. The additional alkylated graphene coating further enhanced flux when used as a filter material, enabling rapid and selective oil removal. Our study presents a straightforward, eco-friendly method for converting hydrophilic materials into hydrophobic surfaces using biomass-derived lignin.