It's subjective and entirely in my head, but the cadence of "I was like, what are you doing here?" feels so much better to me than your version. The like version feels youthful whereas yours is tired.
I actually completely agree, I would only use my version ("said to him") in formal/business settings where I am not very well-acquainted with the majority of listeners in the room!
But, I would probably stray from saying "and I was like, omg lol yes I will happily take your money" when I'm telling one VC about my last round of funding from another VC ;)
As always though, context is everything.