Just like humans dogs dream. A lot of the time your dog will be shaking or twitching in his sleep because he is dreaming about chasing his favourite toy. This sort of shaking is nothing to worry about. However your dog may also be shaking because he is cold, if you suspect this may be the case move him to somewhere warmer to sleep or make his bed a bit more cosy with extra bedding.
A cute young Labrador puppy sleeping with a toy puppy
Shaking could indicate pain. It is likely that if pain or a medical condition is the cause of the shaking your dog will also shake when awake. If this is the case you should contact your vet.