The golden mean or golden middle way is the desirable middle between two extremes, one of excess and the other of deficiency. It appeared in Greek thought at least as early as the Delphic maxim "nothing in excess" and emphasized in later Aristotelian philosophy.
The earliest representation of this idea in culture is probably in the mythological Cretan tale of Daedalus and Icarus. Daedalus, a famous artist of his time, built feathered wings for himself and his son so that they might escape the clutches of King Minos. Daedalus warns his beloved son whom he loved so much to "fly the middle course", between the sea spray and the sun's heat. Icarus did not heed his father; he flew up and up until the sun melted the wax off his wings. For not heeding the middle course, he fell into the sea and drowned.
In education, Socrates asks us to consider the effect of either an exclusive devotion to gymnastics or an exclusive devotion to music. It either "produced a temper of hardness and ferocity, (or) the other of softness and effeminacy." Having both qualities, he believed, produces harmony; i.e., beauty and goodness.
SOCRATES: That any kind of mixture that does not in some way or other possess measure of the nature of proportion will necessarily corrupt its ingredients and most of all itself. For there would be no blending in such a case at all but really an unconnected medley, the ruin of whatever happens to be contained in it.
PROTARCHUS: Very true.
SOCRATES: But now we notice that the force of the good has taken up refuge in an alliance with the nature of the beautiful. For measure and proportion manifest themselves in all areas of beauty and virtue.
SOCRATES: But we said that truth is also inclined along with them in our mixture?
SOCRATES: Well, then, if we cannot capture the good in one form, we will have to take hold of it in a conjunction of three: beauty, proportion and truth. Let us affirm that these should by right be treated as a unity and be held responsible for what is in the mixture, for goodness is what makes the mixture good in itself.
In the Laws, Plato applies this principle to electing a government in the ideal state: "Conducted in this way, the election will strike a mean between monarchy and democracy ..."
In the Eudemian Ethics, Aristotle writes on the virtues. Aristotle's theory on virtue ethics is one that does not see a person's actions as a reflection of their ethics but rather looks into the character of a person as the reason behind their ethics. His constant phrase is, "... is the Middle state between ...". His psychology of the soul and its virtues is based on the golden mean between the extremes. In the Politics, Aristotle criticizes the Spartan Polity by critiquing the disproportionate elements of the constitution; e.g., they trained the men and not the women, and they trained for war but not peace. This disharmony produced difficulties which he elaborates on in his work. See also the discussion in the Nicomachean Ethics of the golden mean, and Aristotelian ethics in general.
Confucius in The Analects, written through the Warring States period of Ancient China (c. 479 BC - 221 BC), taught excess is similar to deficiency. A way of living in the mean is the way of Zhongyong.
Tiruvalluvar (2nd century BC and the 8th century AD; date disputed) in his Tirukkural of the Sangam period of Tamizhagam writes of the middle state which is to preserve equity. He emphasises this principle and suggests that the two ways of preserving equity is to be impartial and avoid excess. Parimelazhagar was the historical commentator of the Tirukkural.
Rambam in Mishneh Torah attributes this method to the first scholars (Chazal), and to Abraham. Indeed, a similar concept exists even in the Rabbinic literature, Tosefta and the Yerushalmi. Yitzhak Arama finds references even in the Bible.
One such instance is Eccl. 7:16-17, where the preacher admonishes his audience to "be not righteous over much" and to "be not over much wicked." Adam Clarke takes the phrase "righteous over much" to mean indulging in too much "austerity and hard study,"  and concludes that "there is no need of all this watching, fasting, praying, self-denial, etc., you carry things to extremes. Why should you wish to be reputed singular and precise?"  Thus, the ideal of the golden mean may have existed as long as six hundred years before Aristotle. However, some scholars, such as Albert Barnes, hold a slightly different interpretation of Ecclesiastes 7:16-17.
Ahead of the times Rambam, 1138-1204 AD (probably due to Plato's and Aristotle's engagement with Ethics), determined that a person has to take care of his soul as well as his body, and just as a person who is sick in his body turns to the doctor, a person who has mental illness needs to go to the doctor of the soul, which is, according to him, the philosopher or the sage. Rambam opposed the deterministic approach, arguing that a person has free will and the ability to change its properties.
Saint Thomas Aquinas, OP, the medieval Catholic philosopher and theologian, in his Summa Theologiae, Prima Secundæ Partis, Question 64, argued that Christian morality is consistent with the mean: "evil consists in discordance from their rule or measure. Now this may happen either by their exceeding the measure or by their falling short of it[.] ... Therefore it is evident that moral virtue observes the mean."
Islam promotes the golden mean in many instances. The Quran states an example in finance, in that a person should not spend all he makes as not to be caught needing, and not to be stingy as to not live a comfortable life. Muhammad also had a saying " " meaning the best choice is the middle ground/golden mean one. In Quran (Chapter 'The Cow', verse number 143) it is said that, "We have made you a balanced, moderate nation".
Quran quotes the example of two groups of people, calling one of them extremely greedy (Chasing the wealth of the world) in Chapter 'The Cow' verse 96 and to the others as inventors of monasticism (over-zealousness in religion) in Chapter Al-Hadeed verse number 27. Islam counsels its followers to abstain from both these paths of extremities and adopt moderation in chasing the world and practicing religion alike.
Not the least the Quran emphasises that the Muslim community ( Umma) is a 'middle nation' / a 'just community' / an Umma justly balanced / a moderate nation / a midmost nation (ummatan wasaTan) in verse 2-143: a middle between extremism and sloppiness.
Many Hindu texts emphasize middle path. For example in verse 6:16 of Gita warrior Arjuna is told by Sri Krishna that "Yoga is not for one who eats too much, or eats too little, sleeps too much or does not sleep enough.
Jacques Maritain, throughout his Introduction to Philosophy (1930), uses the idea of the golden mean to place Aristotelian-Thomist philosophy between the deficiencies and extremes of other philosophers and systems.
"austerity and hard study"
"There is no need of all this watching, fasting, praying, self-denial, etc., you carry things to extremes. Why should you wish to be reputed singular and precise?"