I feel you.
I have been in a similar situation in the past. One of my friend always had 'drama'. Not just limited to her but way beyond that. From possessive behaviour to verbally hitting me in case I do not agree to listen to her.
Your last paragraph is all you need in your life.
I came to think he doesn't write to me for answers but just to release
his anxiety and frustration.
You have hit the spot! Yep. When he approaches you, your mind wants to 'help him out', so it starts getting 'in the zone'. i.e. putting yourself in his shoes, making you feel everything that he feels. After your brain comes up with a solution, bam! You have no one to listen to! Your brain is tired and exhausted.
Look. You don't have to do this to yourself.
Remember: You are not a punching bag.
How to handle the interaction in a way
that he stop flooding me with his negativity without hurting his
feelings or making feel abandoned?
You are in a state of an 'abusive relationship'. Mentally abusive. Friendship is also a relationship. I might be assuming here but I reckon, you owe a favour to this friend of yours and there is a great deal of his influence in the past, or, you are indebted for something to him, which you believe you have to carry on. If latter is the case, following is for you, otherwise, you are better off without this "friend".
There are 3 hacks.
1. Over empathize! Fight drama with drama!
Ever been to a restaurant and sat there for more than you should? The owner would pester you 'services', if you make an order, good for him, or else... you get the message!
About six months ago, I had an issue with my credit card and I called up the support guys. The guy was probably a trainee and he said things like, "We do not want you to experience this.", "This is heart breaking.", "I am so sorry you have to go through all of this.", "This is really bad.", "I do not see the problem with your file, maybe these are just one of those errors but I am so sorry that you have to go through this.". After a point, it started feeling 'fake'. Next time I have an issue, I am sending them an email.
2. Make use of the word - Drama
Maybe it is a good idea to show the mirror!
Mr Underwood once said: (fictional but effective)
I really believe you. Your life is like a drama to me. Never-ending pain. Sometimes it is so hard to believe any of this to be true but I believe you since you say it.
Try the magic spell above and let me know in the comments!
People like him tend to "oversell" their pain. Using a flood of naked truth "it is so hard to believe any of this", will hit them at the right spot.
3. Be wary of gaslighting
gerund or present participle: gaslighting
manipulate (someone) by psychological means into doubting their own sanity.
"in the first episode, Karen Valentine is being gaslighted by her husband"
I had my own share of 'being polite', as you are going through but my therapist once told me, "Don't try to help those who do not want to be helped.".
I had my own share of feeling nauseated and cursing myself, strangling in political correctness that I was harming myself more than helping the other.
I realized when I am good to myself, I can effectively help more people.
You are doing a great job!
You do not deserve to go through this.
Do not over-do. Leverage your EQ. Ask your friend to take professional help and make sure you tell them exactly how you feel. Turn the table.
If you are attacked, do not take it personally. I am telling you from my experience, once I showed them the mirror, she was in a complete denial and made me check my own sanity. I shrugged her words from me.
Trust me, even if you feel bad for few minutes or hours, in the longer run...... it is liberating :)