Letting go of the ego a bit is something you have to find within yourself.
After that, it's easy. If the criticism is about the code, either accept it or be analytical with a thoughtful "defense" of the code. It leads to good technical conversation and the code benefits from it, and either one or both of you will learn something. Learning things tends to go away the more senior you get so the opportunity becomes exciting at some point.
If it's about you personally, then it's no longer constructive criticism and thus a civil response about keeping things on topic usually suffices.