So be patient over what they say and exalt [Allāh] with praise of your Lord before the rising of the sun and before its setting; and during periods of the night [exalt Him] and at the ends of the day, that you may be satisfied.
Many Nations were destroyed and in Them is a Lesson
Allah, the Exalted, says,
أَفَلَمْ يَهْدِ
(Is it not a guidance for them...) This is addressed to those who reject what the Prophet came to them with: `We destroyed those who denied the Messengers from the previous nations before them. They showed open hostility, so now there is not trace of them and none of them are left. This is witnessed by the empty homes that these people left behind, and which others have now inherited, moving about in the dwellings of those of the past.'
إِنَّ فِى ذلِكَ لأيَـتٍ لاٌّوْلِى النُّهَى
(Verily, in this are signs indeed for men of understanding.) This means those who have sound intellect and correct understanding. This is as Allah says,
فَاصْبِرْ عَلَىٰ مَا يَقُولُونَ (So endure what they say - 20:130) The people of Makkah offered various excuses to justify their rejection of the religion brought to them by the Holy Prophet and these included derogatory remarks against his person also, such as branding him as a sorcerer, a poet or even an untruthful person. The Qur'an suggested here two weapons to combat the torments aimed at him by the infidels of Makkah. One was to show patience and forbearance in the face of all provocation, and the other was to devote himself wholeheartedly to prayers, as the words وَسَبِّحْ بِحَمْدِ رَبِّكَ (and proclaim the purity of your Lord) suggest.
Patience and prayers are the only remedies against aggressive hostility
Everyone in this world, whether he is big or small, good or bad, has enemies and these enemies, however weak and feeble they may be, can do harm to their opponents. If they are not strong enough, they will not hesitate to stab them in the back, and failing everything else they will use abusive language which is equally hurtful. Therefore everybody has to be on his guard to protect himself from the hostile designs of his enemies. The Qur'an has prescribed two very effective tools for use in such a situation. One is patience, forbearance and to eschew all thoughts of revenge, while the other is to occupy oneself in prayers and invocation of Allah. A person whose thoughts are full of revenge is often unable to exact it from his enemy despite his power and influence and is consumed with chagrin and frustration. On the other hand a person who devotes himself to prayers finds solace in the belief that nobody can harm him without the will of Allah and that whatever Allah wills has a hidden purpose behind it. This belief not only affords him satisfaction but also frees his mind from all thoughts of anger and revenge resulting from the hostile acts of his enemies. The words لَعَلَّكَ تَرْضَىٰ (So that you may be pleased) occurring at the end of the verse mean that "If you follow this advice, you will be able to lead a happy and contented life".
وَسَبِّحْ بِحَمْدِ رَبِّكَ (And proclaim the purity and praise of your Lord - 20:130) Here the direction of proclaiming Allah's purity is followed by the direction of proclaiming His praise. It implies an indication that when a person is given taufiq to remember Allah by performing dhikr or any other form of worship, it should not make him proud of it. Instead, he should praise Allah, because without His taufiq (facilitation) he could not perform that worship. Then, proclaiming the purity and praise of Allah may mean invocation of Allah and His praise, and they may also mean the prescribed prayers. The subsequent fixed times which have been mentioned obviously refer to prayer timings. Thus قَبْلَ طُلُوعِ الشَّمْسِ (before the sunrise) means early morning (fajr) prayer وَقَبْلَ غُرُوبِهَا (before it sets) means midday prayers (zhur) and afternoon prayers (` asr) while وَمِنْ آنَاءِ اللَّيْلِ (and in some hours of night) means all prayers after sunset i.e. maghrib, ` isha' and tahajjud. The words أَطْرَافَ النَّهَارِ (the edges of the day) are intended to put additional emphasis on Fajr and Maghrib prayers.
Tazkirul Quran
Maulana Wahiduddin KhanOn ayahs 130–131
If a community reaches the zenith of its progress in the world and then is made to face destruction or subjection, it is always because it has transgressed its limits. Every community so destroyed leaves a lesson for its successors. But there are very few people who care to learn a lesson from such events. It is worth noting that the advice given here about the repeated glorification and remembrance of God and prayer was first given in Makkah; these practices were meant to be observed in the most trying and serious conditions of the Makkan period. This indicates that in the most difficult days of denial and tough opposition, prayers (salat) and remembrance of God are the best shields for the faithful. The principal benefit to man of these actions is that they lead to a smoothing of the paths to success in this world and the next.
Uthmani text of the Madinah mushaf (King Fahd Complex). Translation: Saheeh International. Tafsir via Quran.com.