me and my friend were messing around one day and I played a couple pwer chords around the neck and he whipped out a solo that went perfect with it...then i tried to solo when he played power chords and it sounded like crap the notes were not going together at all I asked him how and he said something bout a key or somethin

so PLZ help with this all I want to kow is what its called and how to do it!!!

Try learning the pentatonic scale, I think it's in the Music Theory FAQ.

You can play any note in that scale in a certain key and it will sound good over a progression in the same key.
Soon you will sit on the bench
of those who deny I have my soul
You sell a dream you create
Condemned by what you condemned before
Smooth are the words you sing down and high
Underground is your joy your laws
He was probably talking about what key the chords you were playing were in, then choosing an appropriate scale to use on top.
For example if you were playing chords that fit in C Major (eg C, F, G) he would use a CMajor scale or something similar.

Look in the UG theory lessons. I'm pretty sure they have heaps of stuff explaining things like this.