# Water doesn't flow above the rim, one reason is surface tension. Is another reason viscosity? According to Surface tension, water molecule don't get the force from outside and get little bit outward. Is one reason viscosity? Let's look at the water in a fully filled glass. No part is outside the surface.

Now I pour more water, due to friction from lower level, water doesn't flow towards the side and stays there, the more water we add the more surface is build above 0 level. As the level increases, force of friction decreases, and at certain point, force of friction is overcome by water flow and water flows out.

So there are some water left above the surface of fully filled glass and one of the reason reason is viscosity?

What happens is something that is very much related to friction though. Depending on surface tensions of water-air, water-glass and glass-air, the water-air interface should have a certain contact angle with the glass according to the Young's equation: $\gamma_{sg}=\gamma_{sl}+\gamma_{lg}\cos\theta$. This is the $\theta$ indicated in the figure below. The typical contact angle for water-air with glass will be low.
When the glass is still filled below the 0-level the water-air interface nicely forms the contact angle that is energetically favored at the edge of the glass (top image). Now when you add more water at a certain point the water reaches the edge of the glass. In order to have the water flow over the edge the contact angle has to become the energetically favored $\theta$ again , but now with respect to the (here) flat rim of the glass (bottom image). As long as this angle is lower there will be a force per unit length at the interface of magnitude $\gamma_{lv} (\cos \theta_{current}-\cos \theta_e)$ which points inward and keeps the glass from overflowing. 