Is it really that important to count the beats in your head when playing in order to keep a solid rhythm.
I was playing a random set of chords with a metronome and could keep with the beat but couldn't count 1234. I was playing each chord for two bars with the metronome making a different beat on the one twice. I found I could only really count like 1 and 2 and, the numbers wouldn't be on the correct beats but I was playing in time
Also when im improvising a solo over a backing track, I just listen to the beat and stay in time that way and not by counting
This said, I often read and hear ppl saying how important it is to keep count
You ultimately want to play in time, not count to four in your head. Do what you have to in order to be in time. You will probably find that counting sometimes helps you, particularly when you're practicing. (There is a huge difference between practicing and playing.)
Skilled musicians don't keep count in their head per se, but they are aware of it because it has become second nature to them. They can stay on beat without thinking about it, but their training allows them to be aware of when they aren't on beat, for whatever reason, and correct for it.
Keeping count is important for rests though, since the music is gone and you have to rely on your internal rhythm to come back in at the right time.

I always recommend listening to pop music when trying to build internal rhythm because that music makes the beat really clear. Try counting along to that instead of a metronome.
^^The above is a Cryptic Metaphor^^

"To know the truth of history is to realize its ultimate myth and its inevitable ambiguity." Everything is made up and the facts don't matter.

A metronome is great for practicing, however it's only good to a certain point. Ever listened to a song that had a ritardando? In other words, it slowed down or changed tempo? A metronome will do you no good during a tempo change. I recommend learning to tap your foot while playing.

When I'm lead playing guitar with my group, I listen to the rhythm guitarists for the beat. I also tend to tap my foot. I don't count beats, but I do watch and listen for those places in a song where there's a modal interchange, or something else funky going on.

When I'm playing jazz lead, it's necessary to keep track of the beats in a measure, since you're constantly changing keys. Even then, it's not so much counting beats in a measure, as it is feeling when it's time to make a change.