This is a bridge in Paris. You hang locks on it with the name of you & your boyfriend/girlfriend/bestfriend then throw the key into the river. So even though the friend/relationship may end, you can’t remove the lock. On the bucket list board you go!
Simply use the basic knot you’d use to make friendship bracelets to wrap the main cord and each of the individual earbud cords. To make them even more tangle-proof, wrap plastic coated twist ties inside with the cord.