Plato, in The Republic (507b-509c), uses the sun as a metaphor for the source of "illumination", arguably intellectual illumination, which he held to be The Form of the Good, which is sometimes interpreted as Plato's notion of God. The metaphor is about the nature of ultimate reality and how we come to know it. (Socrates is the speaker of The Republic, but it is generally believed that the thoughts expressed are Plato's.)

The eye, Plato says, is unusual among the sense organs in that it needs a medium, namely light, in order to operate. The strongest and best source of light is the sun; with it, we can discern objects clearly. Analogous things, he writes, can be said of intelligible objects (i.e., the fixed and eternal forms that are the ultimate objects of scientific and philosophical study):

When [the soul] is firmly fixed on the domain where truth and reality shine resplendent it apprehends and knows them and appears to possess reason, but when it inclines to that region which is mingled with darkness, the world of becoming and passing away, it opines only and its edge is blunted, and it shifts its opinions hither and thither, and again seems as if it lacked reason. (The Republic bk. VI, 508d; trans. Paul Shorey)

By "the world of becoming and passing away" Plato means the familiar visual or perceptual world we see around us. Thus if we attempt to understand why things are as they are, and what general categories can be used to understand various particulars around us, without reference to any forms (universals), we will fail completely, as if [we] lacked reason. By contrast, "the domain where truth and reality shine resplendent" is none other than Plato's world of forms--illuminated by the highest of the forms, that of the Good. Since true being resides in the world of the forms, we must direct our intellects there to have knowledge, in Plato's view; otherwise, we are stuck with mere opinion of what may be likened to passing shadows.

Plato also says the sun and the Good ("the object of knowledge") are both sources of "generation":

The sun ... not only furnishes to visibles the power of visibility but it also provides for their generation and growth and nurture though it is not itself generation. ... In like manner, then ... the objects of knowledge not only receive from the presence of the good their being known, but their very existence and essence is derived to them from it, though the good itself is not essence but still transcends essence in dignity and surpassing power. (509b)

This is one of the passages that leads some to infer that the Good is, for Plato, God, though there is some dispute about this point. Many modern readers will find it puzzling that one and the same thing is called the Good, the source of being (the being of the forms, at least), something that (somehow) sheds light on all other forms, and a universal. Indeed, exactly how it is Plato thinks "very existence and essence is derived to [the forms] from" the Good is a matter of considerable interpretive difficulty.

This doctrine conveyed by the metaphor of the sun is, incidentally, an excellent example of how, traditionally, the subjects of metaphysics and epistemology have been closely intertwined: accounts of what exists, at a fundamental level, often deeply inform (and are informed by) accounts of ways or kinds of knowing. It also neatly sums up two views for which Plato is well-known: his rationalism and his realism (about universals).

Plato goes on to describe the levels of reality and knowledge with the device of the so-called "divided line" (509d-513e). Immediately afterwards, at the beginning of Book VII, the same doctrine is elaborated using the famous allegory of the cave (514a-520a).