The Root of the Behavior
Dogs may like to lick before they go to sleep because it stirs latent memories of when they were puppies. From the moment they're born until they're separated from their mother, puppies are subjected to vigorous maternal tongue washes. It stimulates their growth and keeps them clean. It's also the mother dog's unique way, apart from feeding them, of giving her babies affection. While your dog may enjoy a bath and possibly often needs one, let's face it, it's not practical or healthy to give him one every day. Your dog having a lick before he goes sleep could mean he's just sorting out his own personal hygiene in-between times. Nature failed us when she didn't give dogs the capability to talk. A fact which is only forgivable because we love them just the way they are. But wouldn't it be so much easier and eliminate all the guesswork, if they could just tell you what they were feeling?
A dog, especially an older one who's getting on in years, can lick before he goes to sleep in an attempt to alleviate pain. Arthritis and rheumatism are not just human afflictions, they can also affect dogs. Pain can happen in a younger dog too. Maybe, with only good intentions in mind, you've overdone his exercise routine and he's licking his legs in the hope of massaging away the discomfort of his aching muscles. He could be feeling a bit like us after we've overexerted ourselves in the gym. Dogs get allergies too. Apart from having a good scratch, the only way they've got of dealing with an itch is by licking it. Have you considered the possibility your dog has started licking before he sleeps because he's having an allergic reaction to something? The same as with children, while they're occupied and running around, they'll ignore whatever is making them feel unwell. When they're in their bed, alone and quiet, the symptoms will manifest and as a child would scratch at what ever was bothering them, a dog will react by licking because the itching is driving them nuts. Constantly licking at a wound or infection is the way dogs cure themselves. As worrying as it may be, can you be sure your dog hasn't got something physically wrong?
Encouraging the Behavior
A dog licking excessively before it goes to sleep can be a good indication that things are not right with him. You should try checking which area he is focusing his licking on. Is it his belly or maybe his paws? Or maybe is it his nether regions? If his licking is concentrated on his rear parts, getting your pup checked over at the vet's is a good idea. Your dog may well have some infected anal glands which need treating. Parasites, such as fleas, tend to be more active at night so you should check him for little critters too. He could just be trying to let you know he's picked up a few bugs while running around in the park and whichever preventive measure you have been using has sadly not been working. Your dog licking himself to sleep could also be a sign he is missing his momma's maternal caresses. Was he taken away from his mother too soon by the breeders? This can cause your dog to miss his mother's licking so he does it for himself. However, he may just be doing it because it feels good. Or it may be a ritual that helps him go to sleep.
Other Solutions and Considerations
If licking before he goes to sleep is new for your dog, have you considered checking out the detergents you wash his bed in? Have you changed soap brands recently? Dogs, just like humans, can be allergic to a million different things, including certain brands of soap. If he is executing a concentrated nibbling of his paws, he could be having a reaction to grass pollen from running around in the park or garden. If it's a more all over his body reaction, it could be down to his food or even the cat if you have one, but we won't go into that.
Dogs lick before they go to sleep for myriad reasons. It's natural as long as it's not excessive. In some instances, your pet could just be replicating the sensation of you stroking him because you're no longer doing it. You're out or you've gone to bed. He could well be missing you. Licking himself, if not a full replacement for the real thing, is the next best thing he can do.