Practice..that the only way...it comes with time really. the more you play and the more ear training you do the sharper your ear will become to differences in notes. At 2 years I wasn't able to do anything by ear.
Try the ear training links here and make sure you're getting to grips with notes on your guitar if you haven't already. Force yourself to tune by ear as much as possible too. Start off even by just tuning one string and then try and tune from there using octaves and unison notes. It's something you do just slowly pick up.
I recently read Oliver Sacks' (psychologist) book, "Musicophelia":


Sacks is interested in how our brain processes music, and also how music affects the brain.
He points out many problems people can have in this regard.
Some people are simply "tone deaf". They literally cannot distinguish pitches. There is no help for this, it's part of one's brain structure.
You can also be deficient in hearing harmony (I have little ear for harmony), melody, or rhythm.
Again, if this is the case, there is not a lot that can be done; no amount of "training" will result in much improvement.
We had a friend who was determined to play and sing. Even after months of practice, she sounded terrible. Off-key, no sense of timing...
Another of our friends recorded her on a pro-quality reel-to-reel (no digital back then!) tape deck, hoping that when he played it back she'd see how bad she sounded.
Didn't work...She thought she sounded just fine!

Don't give up, this may not be the problem. Not everyone has perfect pitch and absolute timing and all those other "gifts".....They manage to muddle through. Even Chet Atkins claimed he was terrible at tuning the guitar.
Hey dude, I started playing 17 months ago and I had a HORRIBLE ear... It was really really frustrating, not even able to tune my guitar by ear. I've done a whole lot of ear training and now I can recognise some things like intervals (distance between notes), and I can tune my guitar by ear as long as one string is in tune I can also tune it down to drop D A musical ear is like puberty, it is so horrible when you start out, not understanding anything, but as time passes by things'll all get better in the end. Usually :P
Basically, despite my 2 years of guitar, I can not for the life of me tell, for example, if two notes are the same, I can't find riffs by ear and frankly, I can barely tune my guitar.

Anyone know a way of improving this?

I was pretty much in the same boat at your stage, to be honest, and the main things that help are listening and paying attention. Trying to work things out and concentrating will help even if you get it wrong - you'll gradually get better at it.

Do you tune your guitar by ear (any method at all, just not a tuner)? If not, start doing that as well.

The justinguitar stuff is great.
I think its fun to try tuning your guitar using 4ths or 5ths (especially those two, cause they're just so darn perfect).

It's kinda entertaining, I guess.
"If you're looking for me,
you better check under the sea,
because that's where you'll find me..."