The phrase which is frequently used by Muslims in the form of a prayer, is from the Quran. 


172الَّذِينَ اسْتَجَابُوا لِلَّهِ وَالرَّسُولِ مِن بَعْدِ مَا أَصَابَهُمُ الْقَرْحُ ۚ لِلَّذِينَ أَحْسَنُوا مِنْهُمْ وَاتَّقَوْا أَجْرٌ عَظِيمٌ
3|172|Those who responded to God and the Messenger, despite the persecution they had suffered. For the virtuous and the pious among them is a great reward.
173الَّذِينَ قَالَ لَهُمُ النَّاسُ إِنَّ النَّاسَ قَدْ جَمَعُوا لَكُمْ فَاخْشَوْهُمْ فَزَادَهُمْ إِيمَانًا وَقَالُوا حَسْبُنَا اللَّهُ وَنِعْمَ الْوَكِيلُ
3|173|Those to whom the people have said, “The people have mobilized against you, so fear them.” But this only increased them in faith, and they said, “God is enough for us; He is the Excellent Protector.”
174فَانقَلَبُوا بِنِعْمَةٍ مِّنَ اللَّهِ وَفَضْلٍ لَّمْ يَمْسَسْهُمْ سُوءٌ وَاتَّبَعُوا رِضْوَانَ اللَّهِ ۗ وَاللَّهُ ذُو فَضْلٍ عَظِيمٍ
3|174|So they came back with grace from God, and bounty, and no harm having touched them. They pursued what pleases God. God possesses immense grace.
hasbi allah wani'mal wakeel

hasbi allah wani’mal wakeel

In Sunni literature this verse is reported to be what Nabi Ibrahem AS said when thrown in the fire : 

Sahih Al-Bukhari Hadith 6.86 Narrated by Ibn Abbas

‘Allah is Sufficient for us and He Is the Best Disposer of Affairs,” was said by Abraham (a.s.) when he was thrown into the fire; and it was said by Prophet Muhammad (saws) when they (i.e. hypocrites) said, “A great army is gathering against you, therefore, fear them,” but it only increased their faith and they said: “Allah is Sufficient for us, and He is the Best Disposer of Affairs.” (3.173)


From Shia literature :

H 3338, CH 52, h 6 in Al Kafi

A number of our people have narrated from Sahl ibn Ziyad from certain individuals of his people from Muhammad ibn al-Faraj who has said the following: “Once abu Ja’far ibn al-Rida AS wrote to me and instructed me with this supplication saying, ‘Whoever recites it after the morning prayer, his wish will come true with ease and Allah will suffice him: “(I begin) in the name of Allah and with Allah. O Lord, grant al-Salat (favors) upon Muhammad and his family. I plead before Allah to keep my affairs in trust with Him, Allah knows well (His) servants. ‘Allah protected him (the believer among the people of Pharoah) against the evil of what they had planned against him. . . .’(40:44,45) ‘No one deserves to be worshiped except You, You are free of all defects. I have been unjust to myself.’ (21:87) ‘We answered his prayer and saved him from sorrow and thus, We save the believing people.’(21:88) ‘. . . Allah is sufficient for us and He is the best representative.’ (3:173) ‘They returned with the bounties of Allah and additional favors without being touched by evil. . . .’ (3:174), it is as Allah wills, there are no means and no power without Allah, the Most High, the Most Great. “It is as Allah wills, not as people will. It is as Allah wills even though people may dislike it. Sufficient for me is the Lord instead of those cherished, sufficient for me is the Creator instead of the creatures, sufficient for me is the provider of sustenance instead of the recipients of sustenance, the One Who has always been sufficient for me from the time I existed, sufficient for me is Allah besides Whom no one deserves to be worshiped, before Him I place my trust and He is the Lord of the great Throne.’ “The Imam said, ‘When you complete an obligatory prayer say, ‘I have accepted the fact that Allah is my Lord, Muhammad is the Holy Prophet, Islam is the religion, the Holy Quran is the Book and so and so . . . (mention your ‘A’immah) are my ‘A’immah. O Lord, protect Your friend, (whom You have granted Divine Authority) so and so . . . (mention the twelfth Imam) from all directions, front, back, right, left, above and below, grant him a long life and make him the one who will rise with Divine Authority to support Your religion, show him what he loves and is the delight to his eyes, in his own person, his descendants, his family, belongings, his followers and his enemies. Show them (his enemies) what frightens them and show him in them what he loves and be the delight to his eyes, grant the cure for our suffering chests (hearts) and the chests of the believing people.’  

The Imam said, ‘The Holy Prophet after completing a prayer would say, “O Lord, forgive me for what I have done and what I will do, what I have hidden, and what I have done in public and forgive my excesses against my own self and that about which You know better than I do. O Lord You are the One Who can move things forward or backwards with Your knowledge of the unseen and through Your power over all creatures. I pray to grant me life as long as it is in my best interest and cause me to die when it is in my best interest. I plead before You to grant me a sense of concern about You in private and in public, to say the words of the truth in anger or happiness and to economize in poverty and in wealth. I plead before You for bounties that will not vanish and such delight of the eyes that will not discontinue. I plead before You to make me be happy with (Your) determination, with the blessing of death after life, the comfort of life after death, the pleasure of the look at Your face (things that lead to You), the excitement of seeing You, meeting You without being harmed or suffer harmfulness or the misfortune of straying. O Lord, beautify us with the beauty of belief and help us to be guided guides. O Lord, grant us guidance in the matters of
those whom You have guided. O Lord, I plead before You for determination in understanding, steadfastness in the affairs, and good understanding. I plead before You for the opportunity to thank You for Your bounties, Your granting good health and yielding to Your right. I plead before You O Lord, to grant me a peaceful heart, and a truthful tongue. I beg You for forgiveness for that which You know. I seek protection with You against the evil of that which You know; You know and we do not know. You have the knowledge of the unseen.’”