My dog sleeps in my bed and he growls at me if I accidentally touch him with my foot while sleep. He gets quite vicious. Is there any way I can correct this behaviour without having to make him stop sleeping in my bed?

So, there are a couple of things going on here that need to be corrected, first and foremost the power dynamic between yourself and your dog.

When your dog growls at you when you get into “his” space on the bed, what he’s saying is “This is mine, all mine, stay out!”

No. It isn’t. It’s yours. All yours and your dog is happiest when he knows you are in charge, you are the boss of his little pack, you make the decisions, and he submits to you in all things without question. The consequence of your dog asserting dominance in anything is the immediate removal of that thing by you. Therefore, yes, if a dog acts as if the bed is his, he must be made to leave the bed by you as a demonstration that it is YOURS.

He can be allowed back at a later time when he is behaving properly, and only so long as he continues to behave properly.

This kind of problem most often happens with small dogs. (Not universal, but commonly.) The reason for that is that owners often treat dominant behavior from small dogs as “cute,” or at a minimum, nothing to worry about. The best thing to think about when training a small dog is this:
How would you feel if your dog was behaving the way they are right now and looked like this:

If you would immediately correct behavior from a big dog, you should immediately correct that behavior from a small one in exactly the same way, because despite the size, It’s the SAME behavior, with the same psychology behind it.

Your dog is in need of some training, and more importantly, in a sense, so are you. You need to learn how to behave as the leader of your dog’s pack, how to calmly assert your leadership over every facet of his life, and to project energy towards your dog that makes him feel safe, protected, and subservient. He should never feel like he NEEDS to take charge, he should always feel that you are the one in charge and that’s a good thing.

That starts with walking him a couple of times a day, and not allowing him to lead the walk. It is your walk, and he is along for the stroll. He may not pull ahead on the leash, he may not go wherever he wants, he needs to walk beside you on a loose leash. Every time he pulls the leash tight, you stop in your tracks, give it a little tiny yank to communicate that he is out of bounds, and wait for him to come back to you and settle down, even if that takes a lot of time. The more frequently and consistently you do it, the quicker he will get the idea. The walk, to a dog, is a patrol around the pack territory. If you are without question leading the walk, then you’re the guy in charge of the pack. If your dog is leading it, they are, and the rest of your interactions will suffer from this power imbalance.

Remember that the leash is not a restraint, it’s a communications device. It should not be needed to restrain your dog, it should be used with small tugs and pressure to tell your dog where you want him to go. That’s why retractable leashes SUCK. A dog is ALWAYS pulling a retractable leash taunt, and therefore ALWAYS feels like they’re in the lead. If you are using a retractable leash, you should always lock it at a comfortable length so that the dog can walk near you without tension on the leash.

If all it takes me to manage a 60 lb Pit/Lab mix is a pinkie through the loop of a leash, surely there isn’t a dog that needs much more once they get the idea that they’re not allowed to wander off.

Properly walking your dog leads to other training opportunities. He should learn to sit when you stop to look both ways to cross the street. You can use a command like “Street,” work with him to understand that “Street” is a sit command, and suddenly the idea will dawn on him that there are more things in the world that mean “Sit” than just the word “Sit.” In my house, Touching the doorknob is a sit command. If I drop my dog’s leash, it’s a sit command. Fang was an absolute BOLTER when she was young, so we had to find creative ways to curb her instincts to bolt out the door when someone opened it a crack, or to take off when someone dropped her leash by mistake.

The more you work with your dog, the more confident you become, the more a calm, assertive energy projects from you, you are the boss, you are the person absolutely in charge and you don’t have to prove it, you just know it, the more your dog falls into the routine of behaving that way.

Do you know why Cesar Milan corrects his dogs with the little “Tsch” noise he uses? It’s not because it’s some kind of magic sound that makes a dog drop everything and listen. It’s because it’s the noise his mother used from across the room when she would catch him doing something wrong that he needed to stop right away. So imitating that noise helps him project the same calm, assertive energy that his mother directed at him when she caught him stealing candy off the countertop when he was a kid.

That’s why my dog stops whatever she’s doing when she hears my mother’s typical “EH-EH!” from across the room. It’s not the noise, it’s the energy.

When that dynamic is achieved, if you want them on the bed, they may come up on the bed, but they will already know whose bed it is and will respect the space while being happy with whatever space you allow them.

The best thing to remember is that the biggest kindness you can do your dog is to make sure he never feels like he has to take charge. A subservient, middle-of-the-pack dog is a happy dog who knows the top dog has his back and he doesn’t have a care in the world.