TL;DR:
- Without being honest with your friend about your wish to break contact, or just stop replying to their messages, you're not going to be able to 'stop your contact' abruptly.
- You say the contact is already slowing down, so letting 'nature run its course' may be the best option for you if you don't mind a longer-term approach.
- There are ways you could try to deliberately decrease the quality and quantity of the contact you have, but none of them will guarantee a total stop to all contact, ever.
While it is nice that you care about their feelings on this matter, and about staying polite, if things have gotten to a point where you consider breaking contact immediately and abruptly, you're going to have to bite a bullet. A sudden breakup, however well or badly done, is very likely to have negative effects, just due to the mere nature of the event:
Breakups are extremely stressful, unpleasant, and traumatic events, regardless of whether the individual in question is the one who actively made the decision to end the relationship.
You can try to bring a message as gently as possible, but even that doesn't grant you full control over another person's feelings and thoughts. So there's no way you could do this that guarantees there won't be ill feelings towards you later. I would personally say talking about this first is better than ghosting, just because I feel having a reason for things, however much I may disagree with it, still provides more closure than never having that reason.
If you do decide to talk about it first, a good place to start would be by using "I-messages". That's probably the biggest thing you could do to avoid giving them the feeling they're not good enough: Focus your messages on the problem at hand, on how you feel about the friendship (not them as a person). If they already know about that place you 'do not want to go', this might be an easier talk. If not, be clear that you're feeling you're going to that place, and that you need to take some time off from being in contact with them, perhaps even indefinitely.
Friendships do have their bumps, and focusing on me and my feelings about situations often helps me talk about tough things with friends and family. It's up to you to decide if this is an option though, I've also seen this backfire. I've been in situations where people pretended to listen to these types of messages, promised to work with me on improving things, and then just go on as usual. You know your friend and the dynamics of the relationship between you two the best.
If you really want to break all contact right now, you can stop reading now. If however, you might also be interested in slowly 'watering down' the friendship, perhaps to a point where it stops existing, keep reading!
You said in a comment that the contact has already slowed down, and that it's mostly limited to chat these days. So, my first and strongest recommendation, if you're interested in a long-term approach, is to just let nature run its course, and see if the contact dies down without you pushing it further. Because what I'm going to describe next comes with a lot of possibility/opportunities for you to make a mistake that may backfire. And that backfiring could make your friend think of you as impolite, which is something you didn't want.
I've written a few answers on this site about some theories on how friendships/relationships form and are maintained:
They might be a good read for you, since once you know a bit of theory about relationships form, deepen, and are maintained, at least you know what not to do.
I've also written another answer where I mention I've been reverting a relationship with a coworker from more personal back to merely professional. From my experience with the situation in that answer, the first thing you must realize is that, if you're not willing to block, ignore or be brutally honest with this person, this is going to take a long time. And I mean long, you could be talking about months or years depending on the relationship you have now. During that time, you will constantly have to be 'aware' of everything you might otherwise just do in an interaction. Also, since we're talking about a dyad here, you're also dependent on the other person not being clingy, on them eventually letting go of the contact with you too.
Okay, on to the lessons learned. First, Social Penetration Theory:
Developed in 1973 by psychologists Irwin Altman and Dalmas Taylor, the theory states that relationships begin and deepen through self-disclosure. In the beginning, people establish relationships by disclosing many simple, harmless facts through small talk. As relationships grow, the rate of self-disclosure slows while the facts disclosed become increasingly intimate in nature. Intimate self-disclosure allows others to penetrate a person’s public persona and discover his or her innermost self. Relationships stagnate when the people involved refuse to self-disclose.
So, the first thing to do is to be aware of what you self-disclose whenever you two are in contact. Are you still disclosing increasingly intimate facts? Or has the friendship between you two already stagnated, slowed down, because neither is self-disclosing much more intimate facts anymore? The conclusion we can draw from that, is that in order to get out of this friendship slowly, one of your options is to get back to levels of conversation that are just 'small talk'. You'll want to get back to a situation where any contact between the two of you is just exchanging these 'simple, harmless facts'.
Take small steps here though. From my experience in dealing with this, you can't just suddenly become disinterested in everything a person used to talk about. But you can make your questions more 'superficial', or even just turn them into remarks. For example, if someone mentions reading a great book, instead of asking what made it so great to them (which is a pretty personal question), you can ask them if it was part of a series (much less personal) or remark that you're happy for them they enjoyed that book.
Lasty, that answer on maintenance behaviors. Scroll down to the bottom, where it quotes an article titled "Maintaining long-lasting friendships.". This article mentions that "Maintenance behaviors can be used strategically, when you realize something needs to be done to prevent e.g. further deterioration of the relationship" and quoted a study that listed four key maintenance behaviors: supportiveness, positivity, openness and interaction.
I want you to realize that doing less of those four key maintenance behaviors can make a friendship/relationship less 'rewarding' for the other person, which in turn could make them less invested in it too. If you want your friend to still think of you as polite though, do less of those maintenance behaviors, but don't go doing the exact opposite. This is a very, very delicate line to walk. For example, when it comes to positivity, you're not supposed to stop returning messages, but you can take a bit longer to do so, and you're not supposed to state that you're ungrateful, but you could express gratitude less often.
On the other hand, your friend may increase their maintenance behaviors, using these strategically. If you notice this increase happening, take it as a sign that you've gone too fast. Again, this is going to be slow, slow work. And you're going to have to put in a lot of conscious effort if you want to do this in a way that isn't "obvious". The change needs to be very, very gradual... think of the metaphorical boiling frog levels of slow/gradual.