The trick is to take advantage of miles promotions by the credit-card companies. Sign up for all their promotional mail and email, and read it when it arrives. The banks, airlines and credit-card companies try all sorts of bonuses and promotions to get you to use their cards, and you want to help them out by taking advantage of the bonuses that will help you.
A helpful trick to get more frequent-flyer miles is to put some tape on each card, telling what particular rules govern its use. For example, you might write on your MasterCard “2x miles for gas, food til Jun 30.” It’s some work, but that is how you build up your miles and so how to fly free.