Completion of each stage will award you medals, with three being the maximum obtainable for each stage. It appears that the only bearing on the number of medals awarded is the time you complete the level in.
You may get this simply by playing each stage if you get three medals on the first try. If not, after completing the game you can go back and replay whatever stages you didn't get all three medals in. The "map" in the game clearly shows each stage and the medals awarded for it making it easy to clean up.