Cut to your ideal weight first. If you say your ideal weight is 205, and you are at 217 right now, go another 12 pounds. This will allow you to start at 'ground zero'. Trying to lose fat and add muscle mass at the same time is possible (i know, cause I did it) but it's slow going and you have to be super dedicated. Also, your body has to be willing to accept that. Mine was, but yours may not be. Your body might be 'confused'. In other words... it may be asking itself, should be adding or shedding?
To repeat myself... I would get as cut as your comfortable with first. Then build muscle from there. This way, your body knows that you have entered muscle building mode. Then keep the high quality protein intake high like LB mentions in his answer.
Personally, I think eggs, beef, starch, and high quality pure whey protein or whole milk (if you are willing to eat dairy) is the surefire way to gain muscle.
I'm a hardgainer, but slowly and surely, I continue to add muscle week after week. I started at 163, then bottomed out at 148. Now I am at 156 and moving back upward. My goal is to return back to my original weight (of when I began my new eating program back in Aug 2010). But this time, I will be ripped and lean at 163, trading fat for muscle.
I've learned to not be in a hurry to 'get there' and instead just take it day by day and stick to the plan.
Oh also, I just thought of something else. How are you lifting? If you want to gain strength (sounds like you are disappointed and have hit a plateau or even began going backwards) then I would recommend making sure that you rep to complete failure every time and don't do too many reps.
What I do is 2-3 sets of 5-6 reps per excercise. As soon as I am able to do 6 reps of any given weight, I increase the weight next time and power through at least 5 reps. Most people don't know that often times that last ONE single rep that feels impossible is where all the muscle/strength is gained. This is because that's when your fast twitch type 2b muscle fibers are recruited to participate the most. This is what 'breaks down' your muscles. Then, in the repair process, it builds it better and stronger.
Last Aug, I began with reps on the bench press of 5-6 reps of 160lbs (my body weight).
Now, I do 5-6 reps of 280, and can likely max at twice my weight (I haven't maxed out in months so I really don't know). I'm not trying to sound like a muscle head bragging about my bench press (such a stereotypical thing to do I know). Im saying that this is what is working me.
Ok I think that's enough,
Cheers for real this time. :)