I play by ear probably 99% of the time now. I started off reading tabs and very early in my playing I realized that tabs weren't always very accurate, so I would look at a tab and get a general idea of the song and basically fool around with it until I got it to a point that I think sounds best. At first, this would take a while to get everything figured out and as time passed I was able to figure songs out quicker and quicker and eventually I just reached a point where I didn't even need to reference a tab as a starting point. I agree very much with Telenator's post about learning as many songs as possible. I would suggest learning songs that you have known very well before you even played guitar, songs you knew front to back as a listener. Songs like that are already so engraved in your memory that once you learn the chords, you can sort of sit back and hear the song in your head just as you always have, but then you can put the pieces together and then your ear for the music will develop faster and faster.
Does that make sense? I've always found this sort of thing a bit harder to explain.
I can't speak for anyone else, but I think this is pretty common in players who learned by ear, but I feel like the honest answer here is I don't really know how I learned to hear and analyze music in my head, it just sort of happened. I did my best to explain the steps I took in learning. Ultimately I always end up feeling like someone is asking me how to do something and I end up saying "well, you just do it" which is obviously not a very informative answer.