What to say in a breakup when trying to remain friends

Me and my bf are pretty much best friends however it’s been very shaky recently (the relationship side) and I think it needs to be ended because we will end up hurt.

He’s quite immature so unless I say the exact right thing he will cut me off out of pride and stubbornness. It’s a extremely hard situation I’m in but I know it’s for the best.

What should I say so that we can stay friends but the point will get across