Five wits

In the time of William Shakespeare, there were commonly reckoned to be five wits and five senses. The five wits were sometimes taken to be synonymous with the five senses, but were otherwise also known and regarded as the five inward wits, distinguishing them from the five senses, which were the five "outward" wits.
Much of this conflation has resulted from changes in meaning. In Early Modern English, "wit" and "sense" overlapped in meaning. Both could mean a faculty of perception (although this sense dropped from the word "wit" during the 17th century). Thus "five wits" and "five senses" could describe both groups of wits/senses, the inward and the outward, although the common distinction, where it was made, was "five wits" for the inward and "five senses" for the outward.
The inward and outward wits are a product of many centuries of philosophical and psychological thought, over which the concepts gradually developed, that have their origins in the works of Aristotle. The concept of five outward wits came to medieval thinking from Classical philosophy, and found its most major expression in Christian devotional literature of the Middle Ages. The concept of five inward wits similarly came from Classical views on psychology.
Modern thinking is that there are more than five (outward) senses, and the idea that there are five (corresponding to the gross anatomical features — eyes, ears, nose, skin, and mouth — of many higher animals) does not stand up to scientific scrutiny. (For more on this, see Definition of sense.) But the idea of five senses/wits from Aristotelian, medieval, and 16th century thought still lingers so strongly in modern thinking that a sense beyond the natural ones is still called a "sixth sense".
The "inward" wits.
Stephen Hawes' poem "Graunde Amoure" shows that the five (inward) wits were "common wit", "imagination", "fantasy", "estimation", and "memory". "Common wit" corresponds to Aristotle's concept of "common sense" (sensus communis), and "estimation" roughly corresponds to the modern notion of instinct.
Shakespeare himself refers to these wits several times, in "Romeo and Juliet" (Act I, scene 4, and Act II, scene iv), "King Lear" (Act III, scene iv), "Much Ado About Nothing" (Act I, scene i, 55), and "Twelfth Night" (Act IV, scene ii, 92). He distinguished between the five wits and the five senses, as can be seen from Sonnet 141.
The five wits are derived from the faculties of the soul that Aristotle describes in "De Anima".
The inward wits are part of medieval psychological thought. Geoffrey Chaucer translated Boethius' "Consolation of Philosophy" into Middle English. According to Chaucer's translation, "ymaginacioun" is the most basic internal faculty of perception. One can, with the imagination, call to mind the image of an object, either one directly experienced or a purely imaginary fabrication. Above that comes "resoun", by which such images of individual objects are related to the universal classes to which they belong. Above that comes "intelligence", which relates the universal classes to eternal "symple forme" (akin to a Platonic ideal). Humans are thus "sensible", "ymaginable", and "reasonable" (i.e. capable of sensing, imagination, and reason, as defined), all three of which feed into memory. (Intelligence is the sole remit of Divine Providence.)
To that quartet is also added "phantasia", a creative facet of imagination. A famous example of this is given by Augustine, who distinguishes between imagining Carthage, from memory (since he had been there), and imagining Alexandria, a pure fantasy image of a place that he had never been to.
The "outward" wits.
The five (outward) senses, as described in Cursor Mundi, are "hering" (hearing), "sight", "smelling" (smell), "fele" (touch) and "cheuing" (taste). It relates them to the five Empedoclean elements (which Aristotle describes in "De Caelo"), with sight coming from fire, hearing from the upper air (the aether), smell from the lower air, taste from water, and touch from earth. This definition of the origins of human senses was an exceedingly popular one throughout the Middle Ages in Europe, not least because of its rough agreement with chapter 30 of the Second Book of Enoch.
The use of "wit" to describe these five senses is illustrated by "The World and the Chylde" (at right) and the following two quotations: 
This definition of five senses has its origins in thinkers that came after Aristotle. Aristotle himself, in "De Sensu et Sensibilibus" defined "four" senses: sight (associated with water because the eye contains water), sound (corresponding to air), smell (corresponding to fire), and touch (corresponding to earth). Aristotle viewed taste as merely a specialized form of touch, which he in turn viewed as the primary sense (because all life-forms possess it). He rejected the earlier view by Democritus that there was in fact only one sense, touch.
Similarly, Plato, in "Theaetetus", has Socrates stating that there are innumerable senses without names, and that the senses with names include hearing, sight, smell, senses of heat and cold, pleasure, pain, desire, and fear.
Aulus Gellius defined five senses, saying "Ex quinque his sensibus quose animantibus natura tribit, visu, auditu, gustu, tactu, odoratu, quas Graeci αισθητεισ appellant" ("Nature has given five senses to living beings, sight, hearing, taste, touch, and smell, called αισθητεισ by the Greeks"). But there is no evidence that this topos existed in the thinking of the Anglo-Saxons, since Old English does not possess the requisite taxonomy, and has difficulty with translations of Latin texts that do.
The concept of there being five senses occurs in Christian sermons, devotional literature, and religious allegories of Middle English, although not all authors agreed exactly which senses the five were. Peter Damian in the 11th century correlated the five wounds that Jesus suffered during his crucifixion with the five senses, which was echoed by John Bromyard in "Summa cantium", although the latter only explicitly mentions hearing, touch, taste, and sight. By the 14th century, Richard Rolle was giving the formulation of five senses that is now familiar:
Chaucer had the same formulation: