After 7 years of private ear-training I still could not tell the difference between a 4th and 5th, or 8th, or 3rd and 6th from hearing them. Failed pretty much every ear-training class in school, had to retake and failed again. On one a few dictation the teacher called me up and asked if I was in outer space. He also made a point to show that "a guitarist doesn't know *****."
So then I had to break it down for myself on my own, because the skill is a compound one, and all of ear-training teachers have perfect pitch - so they can't teach it, because they never had to learn anything. Yes, I hate ear-training and perfect pitch people, it's not their fault... but it's the fault of some of them.
You need to be able to: recognize pitch relationship from the score, recognize pitch relationship from the sound, recognize intervals from score, recognize intervals from sound, recognize pitch relationship on your instrument from score and from sound, recognize pitch relationship from your playing, recognize rhythm from score and from sound, produce proper pitch relationships in your head/voice, recognize pitch relationships from your head/voice, recognize larger form structures from sound and score (which is a compound skill in itself, called music theory). These are usually broken down as: sight-singing, sight-reading, dictations, improvising, analyzing recording of music.
It's a lot. But each skill feeds into another, so as you get better at one, you will get better at another. However, each skill feeds into another - so make sure you practice all. Check out iwasdoingallright.com. He has a great ear-training tool and he shows the way he uses it. Sing with it, play with it. Then, find a bunch of easy duets (method books are great) - like violin, flute, recorder - I found a bunch on IMSLP. Then play one part and sing the other. Can't do that? Play a phrase and sing it after. Then try singing first and playing after. Don't play/sing at the same time. At first, when you're trying to duet with yourself (or 'do it'...yes), ignore the rhythm. Just feel/hear the relationship of your voice to the note you play.
Take a score, listen to a recording with the score, then look at the score again. Use your analytical knowledge (harmonies/cadences/pitch alterations/phrase lengths) and mark it into the score. Then listen to it again and hear what you've analyzed. Have your theoretical knowledge support what you hear. If you intellectually know that the music is modulating, can you hear it? Put on a song and sing the tonic pitch. Then check with the score. Then sing it again.
Little by little, after a year or more, you will feel the results. You'll know where a chord is supposed to resolve, you'll know what to expect and what the possibilities are.
A lot of theoretical analysis is a matter of familiarity - form, cadences, melodic lines. You know what to expect and then you hear what happens and from the sound you can tell which of the possibilities happened (was it a deceptive cadence? a sequence? retransition? fugal passage?).