That is a TALL order. Gaining as much muscle mass as possible and loosing body fat @ the same time. There are so many arguments that it can't be done. Others say its a trade off meaning more muscle comes with more fat and when you lose fat youll loose some muscle too. Alot of people even turn to pharmaceuticals to get the job done.
I'm assuming your asking this because you store more body fat now. There are people who are naturally skinny and they can gain mass without getting fat. Is that your situation? What is your situation (metabolic wise)?
To my knowledge, if you want to keep body fat stores under control while gaining mass, you have to have an eye on carbohydrates.
Lyle McDonald pioneered the targeted ketogenic diet which will help you. It is a low carb diet, but it is interrupted with carbohydrate feedings before and after training. In other words, carbohydrates are used in context.
You should read up on this. But ill say it again, its a tall order to do both.