Goethe wrote his version of Faust in reaction to Enlightenment philosophy which espoused that science could ultimately answer all questions. Goethe, however, believed that some things in life could never be known. As Hamlet says to Horatio, "there are more things in heaven and earth...that are dreamt of in your philosophy" (1.5),
God's lesson to Faust is that no matter how brilliant he may be, no matter how much Mephistopheles may show him of the wonders of creation and of the heavens, there are some secrets that belong to Divinity and will be forever kept from the limited mind of man.
As to the presence of both devils and angels in the poem, they have two functions. First, angels and devils represent the fall of man and his dual nature that can encompass both good and evil. Secondly, they represent that other world which is beyond the scope of human reason which Goethe felt was real but could never be completely understood.
Goethe's philosophy has much in common with the tenets of metaphysics and quantum physics, which postulates that one should "live in the mystery."