Grinding of your teeth while sleeping could be due to stress. It could also be due to occlusal disturbances (Which is a slight discrepancy in how your upper and lower teeth come together - in which case you should consult a dentist). A dentist might recommend that you use a night guard for your teeth, although this will only prevent your teeth from being sore but not solve the underlying issue. De-stressing (although its easier said than done) or some form of relaxation and also equilibration of your teeth by the dentist could be a more long lasting solution. Check with your dentist.
Dr. Farah H. DDS