As they say the worst guitar player is the player that can't hear themselves. However, to hear yourself play truly, hear every mistakes, you make need a lot of practice and experience.
The experience to hear yourself play can only be gained by recording your playing. The more you record the more you learn to hear all the mistakes you make and learn to adjust your playing to get close to perfection. You need to eliminate all the mistakes day by day. Don't fool around on the guitar if you haven't mastered it. I was a session guitar player for a long time but i have learn the biggest lesson from a friend of mine who can play both acoustic and electric guitar much better than me. That's another thing.
When i sat on his studio and recorded for him i saw him close his eyes and move his head along with the song most of the time while recording. That's because he was trying to feel the rhythm of the song, just to groove with the beat, to become the beat. That's when i learned that you need to feel the rhythm to be able to play in the rhythm. The big mistakes most beginners do is try to control their hands to the right beat, that is very wrong, just imagine Michale Jackson try control his legs to get to the right beat while he does his moves, he would surely fail.
The bottom line is, other than listen to yourself play often. You must feel the rhythm to get in rhythm period. It doesn't matter if you tap your foot or not, feel it first! Otherwise, you just gonna sound very bad and stiff, worst is you play out of rhythm. To play out of rhythm, a lot of time it can sound worst than playing wrong notes. Just remember that being a good musician, you need to be a good observer too. Feel the beat!