Hi, there may be some bleeding from the gums when you sleep. Since the blood fills in the mouth and gets mixed with saliva, saliva looks brown in colour as we all know blood turns brown after some time. Please do go to a dentist
and get a complete oral examination done to know the exact cause and take the treatment needed. take care!