You pray to develop a relationship with God, a friendship. It is for your own good. He will give you what you ask for in prayer, anything you ask for, as He told you. But if you ask for sinful things then because He loves you He will give you other things. Think of it this way, you have a toddler who asks for bread, bread is ok and food so yes you will probably give him/her bread to eat… but if it is 2mins before dinner you will not give it to him/her because you have something better for them. They will likely not understand and throw a tantrum. We are like that. But by prayer, we learn to align ourselves to the will of God and accept if something is not given that He knows best and we wait patiently for His will to be revealed. The more we align ourselves to His will (which can only be done through prayer - otherwise how can we know our friends wishes?) the more we get what we ask for, not because we are great but because we ask for what is good for us ie what God will is for us.