I've been boxing for a while now and been very comfortable 2 years in all. I only have one issue: whenever I get hit and it hurts I keep on thinking about the pain and end up not wanting to throw as much. Bottom line is that I get hit and simply fear pain. What can I do to end up desensatized to the feeling of pain?
A few thoughts/leads:
Reduce the punishment you're taking with selective attacks - time hard hits to interfere with the other guy's own attacks. For example, if they're punching in at my floating rib, as soon as I see the prep I'll throw a strong straight punch at their punching-arm-side shoulder, which breaks the body motion they need for getting any power in their punch and hopefully keeps them too far away too. Similarly, if they have a punishing right-leg low kick, I'll attack their left leg strongly to discourage them putting all their weight on it.
Don't encourage them - if you show you're hurting or change your tactics in a way that seems desperate or takes pressure off them they'll simply be encouraged to attack even more fiercely with whatever they think's been working....
Find a little grit! Get in the habit of consciously pushing yourself to go harder whenever feeling you're in a tough spot.
Learn to distinguish pain from injury. If you train hard and take a few blows that are unpleasant at the time, but you can look back a few days later and there's nothing but a few fading bruises to show for it physically, but you've got confirmation that that level of punishment doesn't do any actual harm (except for repeated head blows - that can do real long-term harm). So for every-day training "hurt" - it's a bit like forcing yourself to eat super-hot chilli or go on a crazy-arse roller-coaster... if you've never done anything like that before instincts scream "stop you idiot", but as long as you acclimatise to that level gradually - improving your conditioning to let you cope - it should be fine.
Variation and surprise - rather than getting into a rhythm where they get comfortable punishing you in the same way repeatedly, vary up your footwork, timing, attacks etc. - that way you're more likely to get hit in a variety of ways (hurray!) which at least minimises accumulated hits to the same parts of your body. That helps if there's just one place where you're suffering, but in general you're dealing out as much punishment as you're taking. It may help if you "win" if your stamina is better. Of course, it tends to limit your ability to just pound and pound the same place on your opponent too.
Mental attitude - there are various types of meditation or mental exercises that can transform your attitude towards your own body / let you separate that somewhat from your sense of self. I'm no expert on systematic formal training for that - seems to come pretty naturally - but you could dig around some Zen literature, books on mental preparation for boxing, or something like that....
Tit for tat - distract and refocus yourself by making a mental goal of dishing out more than you're taking. Even as you're taking a blow lash out with your counter. Up the anti until you've got some "pay back". Sometimes something as simple as this expectation and determination can help, because it gives you a short term goal each time. If the opponent sees the short term risk in attacking you they might get more wary and defensive too - it can take pressure off.
To get used to pain: endure pain.
The issue doesn't sound like pain management, though; it's surprise and/or fear.
Pain hurts, by definition. It'll always hurt. In a fight you'll get hurt. You'll get hurt even if all you're doing is hurting the other person–a solid punch hurts the person that throws it too.
I'd probably start by doing some meditation, visualization, and mental rehearsal. Your instincts say "don't get hit" and "pain bad". This is normal. Rehearse getting hit and modulating your reaction. In your mind attenuate the effects of the hit: the pain really isn't that bad, the person isn't really trying to destroy you. Bring your breathing down. Stop the panic, the fight/flight mechanism–it interferes with fighting calmly.
Without knowing any details or playing some games it's difficult to provide much in the way of actionable advice; "don't get hit" isn't really helpful. From the sounds of it you've over-emphasized the consequences of being hit, particularly in a sparring/training setting.
There's an off chance you're more sensitive to pain than most people; that can be tested for, but you would have certainly noticed it in daily activity by now if this was the case.