Meditation helps a lot. You learn to step back from desires and urges, just observing them as they come and go, without automatically reacting to them. They start to feel less like you. That sounds kind of strange, but there’s a big difference between “I’m hungry” and “there is hunger”. “I’m hungry” has a very compelling urgency to it, because it’s tied in with your sense of well-being. “There is hunger” disentangles the physical sensations from one’s sense of identity. You can observe it without feeling threatened by it. You no longer feel that you’ll be miserable if you don’t act on the impulse.
I’ve used hunger as an example, but all of our cravings work this same way. Meditation makes you pay careful attention to the craving process, starting in little ways. You see what your mind does with an itch, for example. As you’re sitting there still, that itch suddenly becomes your world, and scratching it seems like the most important thing in that world. The urge is to get relief by reacting to the itch and scratching. Sometimes, that’s the best thing to do. But not always. Often not, in fact. The question is, can you not react when you understand that that is the wisest course? Understanding the process and learning how not to infuse the feelings with a sense of self is key.