How do you balance an NPC ally with regards to the DMG combat balancing?

My players want an NPC to fight alongside them. They don’t like it when he is "cut out" of the fight and they don’t want it to feel like he isn’t being helpful at all since he’s proven to be competent. I’m okay with having him at their side but I don’t know how to balance the game where he joins as if he’s a party member.

For reference, the DMG has a chart that shows level-to-exp threshold in order to determine encounter difficulty. Since the NPC doesn’t have a level, he can’t be directly added.

Should I:

  1. Add his exp directly to the threshold. So if he has 200 exp, then normal exp threshold + 200

  2. Convert CR to level via Xanathar’s Table for 1-1 player matchups? CR 1/4 = LVL 1 character. CR 10 = LVL 10 character

  3. Subtract EXP from the encounters. Encounter difficulty exp - 200exp

I want to keep the game fairly balanced based on RAW.