Part of verse 59:7 of the Qur'an states, 'That which the messenger gives you, take it, and that which he withholds from you, leave it'. Does this represent a command to seek teachings outside the Qur'an from every word Muhammad said during his lifetime? One way to find out, is to consider one of the most basic methods of understanding any linguistic passage, that is to read the sentences in its given context. This means taking into account the meaning of the entire verse along with its preceding and/or following verses. In the case of verse 59:7, simply reading the verse and a few of the previous verses is enough to make clear its meaning.
Starting from a few verses before verse 59:7, we see that the entire passage from verse 59:2 to 59:7 is speaking of a warfare incident during the lifetime of Muhammad. Verse 59:2 introduces the context that disbelievers who fought Muhammad were defeated at war and consequently had their houses destroyed:
He it is Who drove out the disbelievers among the people of the Scripture from their homes at the first encounter. You did not think that they would get out, and they thought their fortresses would defend them from God. But God's punishment reached them from a place they did not expect, and He cast terror into their hearts. They destroyed their dwellings with their own hands and the hands of the believers. Then take a lesson, Oh you who have vision. (59:2) هُوَ الَّذِي أَخْرَجَ الَّذِينَ كَفَرُوا مِنْ أَهْلِ الْكِتَابِ مِنْ دِيَارِهِمْ لأَوَّلِ الْحَشْرِ مَا ظَنَنْتُمْ أَنْ يَخْرُجُوا وَظَنُّوا أَنَّهُمْ مَانِعَتُهُمْ حُصُونُهُمْ مِنَ اللَّهِ فَأَتَاهُمُ اللَّهُ مِنْ حَيْثُ لَمْ يَحْتَسِبُوا وَقَذَفَ فِي قُلُوبِهِمُ الرُّعْبَ يُخْرِبُونَ بُيُوتَهُمْ بِأَيْدِيهِمْ وَأَيْدِي الْمُؤْمِنِينَ فَاعْتَبِرُوا يَا أُولِي الأَبْصَارِ
The next verse mentions that these disbelievers could have a much worse punishment had it been the will of God:
Had it not been that God had decreed exile for them, He would certainly have punished them in this world, and in the Hereafter theirs shall be the torment of the Fire. (59:3) وَلَوْلا أَنْ كَتَبَ اللَّهُ عَلَيْهِمُ الْجَلاءَ لَعَذَّبَهُمْ فِي الدُّنْيَا وَلَهُمْ فِي الآخِرَةِ عَذَابُ النَّارِ
The verse following the above clarifies that the reason for disbelievers being punished was because they opposed and fought against God and the messenger:
That is because they opposed God and His messenger. Whosoever opposes God, then indeed, God is severe in punishment. (59:4) ذَلِكَ بِأَنَّهُمْ شَاقُّوا اللَّهَ وَرَسُولَهُ وَمَنْ يُشَاقِّ اللَّهَ فَإِنَّ اللَّهَ شَدِيدُ الْعِقَابِ
The verse after that mentions that in the context of the warfare being discussed, trees were cut down as a way of taking advantage, according to the will of God:
Whatever you cut down of the palm-trees, or you left them standing on their stems, it was by will of God, and in order that He might disgrace the rebellious ones. (59:5) قَطَعْتُمْ مِنْ لِينَةٍ أَوْ تَرَكْتُمُوهَا قَائِمَةً عَلَى أُصُولِهَا فَبِإِذْنِ اللَّهِ وَلِيُخْزِيَ الْفَاسِقِينَ
The next verse points out that Muhammad was granted booty / spoils of war by God without necessarily needing military support from his army:
And what God granted as booty / spoils to His messenger, for which you did not have to make battle on horses or on foot, that is because God gives power to His messengers over whomever He wills. God is able to do all things. (59:6) وَمَا أَفَاءَ اللَّهُ عَلَى رَسُولِهِ مِنْهُمْ فَمَا أَوْجَفْتُمْ عَلَيْهِ مِنْ خَيْلٍ وَلا رِكَابٍ وَلَكِنَّ اللَّهَ يُسَلِّطُ رُسُلَهُ عَلَى مَنْ يَشَاءُ وَاللَّهُ عَلَى كُلِّ شَيْءٍ قَدِيرٌ
Finally, verse 59:7 outlines how the booty / spoils of war were to be distributed fairly among the people by Muhammad. As a result, the verse mentions, 'That which the messenger gives you, take it, and that which he withholds from you, leave it' - referring to these spoils / booty:
What God gave as spoils / booty to His messenger from the people of the townships, they are for God, His messenger, the kindred, the orphans, the poor and the wayfarer, in order that they may not become a fortune of greed for the rich among you. So that which the messenger gives you, take it, and that which he withholds from you, leave it, and be conscious of God. Indeed, God is severe in punishment. (59:7) مَا أَفَاءَ اللَّهُ عَلَى رَسُولِهِ مِنْ أَهْلِ الْقُرَى فَلِلَّهِ وَلِلرَّسُولِ وَلِذِي الْقُرْبَى وَالْيَتَامَى وَالْمَسَاكِينِ وَابْنِ السَّبِيلِ كَيْ لا يَكُونَ دُولَةً بَيْنَ الأَغْنِيَاءِ مِنْكُمْ وَمَا آتَاكُمُ الرَّسُولُ فَخُذُوهُ وَمَا نَهَاكُمْ عَنْهُ فَانْتَهُوا وَاتَّقُوا اللَّهَ إِنَّ اللَّهَ شَدِيدُ الْعِقَابِ
Reading the entire context of these verses, it becomes glaringly obvious that the expression in question is specifically referring to Muhammad's role in distributing spoils / booty of war among the people at a time of war. It is not a general expression implying that Muhammad created teachings by himself outside of the Qur'anic guidance. It is a particular instruction relating to a specific incident during the lifetime of Muhammad. This example illustrates how important it is to carefully consider the context of a given verse in order to accurately understand its meaning and avoid obvious misinterpretations.