Till rising and gliding out, I wander'd off by myself, In the mystical moist night-air, (lines 6-7)
Despite his solitude, he feels much less alone once he goes outside the lecture room. The line separating humanity and the natural world dissolves, and he feels a close connection with the night, symbolized by the vapor (moisture) that permeates the air.
and from time to time, Look'd up in perfect silence at the stars. (lines 7-8)
He does not need to speak for the sake of speaking. In some mystical traditions, silence is a "perfect" language, or a language beyond words. It's true, though: the stars make for great company.