I am so sorry it's escalating like this. I have a H who escalates with threats when he doesn't get his way and my response (rightly or wrongly) is to not engage.
I am not a fan of ultimatums because I believe when people are pushed into a corner they come out fighting. But in your situation I would consider it. You have been hear before. You have played this game.
You have a good sense of who you are and what you deserve but you are letting fear get in the way.
I don't know what the laws are where you live, but I assume your H is correct. You cannot force him to move out. And I don't think he will move out of his own volition. Neither do I think will he give up his "mistress". So, irrespective of what you say, what ultimatums you pose, what you threaten to take away (your friendship) he will move into the basement/office and he will engage in intimate activity with her.
But that doesn't mean you have to continue to be his bff. You have choices. By disrespecting you like this he is firing you as his wife. Stop listening to how 'confused' he is (this is pure narcissism) and telling him about how 'painful this is for you' (he doesn't care). Stop acting like his wife. You can choose to live your life (with him in the home) without deference to how living your life impacts him. I am not saying go out and find a man - but I am saying you can choose to not listen to his sh!t. You can choose to say "No" when he asks you to join him in something. You can choose to make plans which don't include him and don't require his approval. Start living your life as if he were not your husband but instead someone who lives in your home. Your actions will speak in the way your words never did.
If he still doesn't listen, then let her have him.