2:186 When My servants ask thee concerning Me, I am indeed close (to them): I listen to the prayer of every suppliant when he calleth on Me: Let them also, with a will, Listen to My call, and believe in Me: That they may walk in the right way.
وَإِذَا سَأَلَكَ عِبَادِي عَنِّي فَإِنِّي قَرِيبٌ أُجِيبُ دَعْوَةَ الدَّاعِ إِذَا دَعَانِ فَلْيَسْتَجِيبُواْ لِي وَلْيُؤْمِنُواْ بِي
لَعَلَّهُمْ يَرْشُدُونَ
This simple verse give you the wisdom of prayer:
1- God is close to us if we to pray and call him.
2- He answer prayers.
3- In return they answer me in the good time.
4- This is good for them that they may walk in the right way.
5- The right way many times help us not to get in problems or deserve God punishment. Thus the right way is good for us and the prayer is good in the good time before the hard time.