I'm sorry, i think you may have got chronic conjunctivitis, and the main cause of it are bacteria, bedsonia trachoma-tis, viruses etc. There are also other pathogenetic factors such as dust, smoke fog, strong light, harmful gas around your living environment. In addition, bad living habits also lead to chronic conjunctivitis. Please avoid staying up too much and get enough sleep every day.
When you are asleep, your eyes may still work at the tears gland system which will deal with the day's coming things in the eyes. The sand may be the thing that comes in during the day and is not absorbed by the inner eyes part. Thus it leaves at the surface of the eyes. You should wash the eyes carefully with the clean water and then use some eye drops to make the eyes get clear and bright.
Ok, it seems so strange to me that you generate sand in your eyes automatically. Well, maybe the reason is that you have got some sand dropped from the ceiling or rubbed your eyes with dirty hands. Just flush your eyes with normal saline to get it out. And visit a doctor if necessary. But I think it is not produced in your eyes. Try to pay attention to your eye health.