Dogs can also be used for other sleep disorders like helping with nightmares and PTSD which can also cause chronic nightmares.
Since nightmares can be a result of PTSD, having a loving pet next to a person can cause more comfort.
They can also sense when something is wrong, like breathing.