I don't bother messing about putting pills in food anymore. I just pop them straight down the dogs throats.

I used my fingers and thumb and push inwards just behind the canines to open the mouth then I place my thumb on the roof of the mouth about an inch behind the front incisors and fingers on the top of the muzzle (Same hand). They won't close their mouth whilst you have them like this and you don't need to hold them hard. In fact, if you use your other hand to gently push the lower jaw down way from the top jaw whilst you are holding them like this, they leave it lowered and don't try to close their mouth again. Just practise doing this a few times a day without popping a pill and end with a treat and praise so they get used to you doing it.

When popping the pill, I just push it as far back as I can get it on the tongue with the free hand then quickly take the free hand and my thumb of the other hand out of the mouth and close the muzzle. I'm careful to put the dogs head back in it's normal position at this point and just stroke the throat. Don't keep the head tilted up. Reason being, if you look upwards towards the ceiling yourself and then try to swallow, you'll find you can't. Same with dogs. They need their head in it's normal position, just use your hands to keep their mouth closed. You'll feel them swallow and if you pushed the pill far enough back, they have no choice but the swallow it anyway. Give plenty of praise afterwards. I often give them pills before being fed so they have their food to look forward to and see the pill taking as a prelude to that.