Story
Sitcoms are not about jokes they are about story. If you have a strong enough story that will generate the laughs. Producers ask that you don't submit the pilot of a series because the pilots submitted usually take the entire half-hour to introduce the characters and establish the premise for the rest of the season and forget to tell a story. However, I don't think the pilot should be exempt from having a good story. Read the pilots of Frasier and Friends to see how simply and economically they set things up. Friends has to introduce six main characters and only Phoebe gets a little left-out. One always thinks the audience needs more information than they actually do. Less exposition, more story.
Try and make the story something we care about. A character trying to win a poker game with 10 pence at stake isn't very interesting so raise the stakes. If they stood to lose their house or a loved one that would make us care more. I prefer comedy stories that would also work as drama stories.
Some writers feel they have to base their stories on real life and experience but comedy isn't real life. A real incident can inspire you, as the story of a hotel guest being found dead inspired John Cleese and Connie Booth to write The Kipper and the Corpse episode of Fawlty Towers, but you have to be true to your show and not true to life. All because a story really happened it doesn't make it funny.
Structure
There are many theories on structure. John Truby suggests that storytelling breaks story structure into the basic steps of human action:
More simply, according to Robert McKee (his book is available here), it is:
There could then be a consequence of that solution which creates another obstacle and so on for five or six times. The aim is to ensure that the structure of your story has increasing conflict and an accelerated pace.
The three act structure is the basis of all sitcoms, even those with a commercial break, and put simply is:
I would suggest that you don't attempt to write your episode until you have your story and structure worked out. It saves a lot of time and hassle. As my grandmother used to say, "Proper preparation prevents piss-poor performance". Here is more on structure.
Dialogue
Writing dialogue is the most fun part of the job and it is tempting to rush the foundation work to get there but that is ultimately self-defeating. Rewriting dialogue is a lot easier than rewriting your story or characters.
The most important thing to bear in mind is that everyone talks in a unique way. Sometimes a character's unique voice flows naturally as you write their dialogue; at other times it might mean going back and re-writing.
As well as a unique voice each character also talks to different people in different ways. The way a character talks to their boss is going to be different to the way they talk to their lover or mother. Add emotions into the mix and your character will sound different again depending on how they react when they are happy or depressed or scared.
Everything a character says should be moving the story forward. Characters just sitting around cracking jokes is dull. Less comic banter, more story.
Some lines can be interpreted in many ways and if this is the case then it's OK to put in a note before the speech saying, for instance, "sarcastically" or "sadly" or to underline a word that needs emphasising. However only do so when a line's interpretation isn't obvious otherwise it's insulting to the actors. Dialogue performs (or should perform) a number of functions, the primary ones being: 1. Advance the story 2. Provide information 3. Reveal character 4. Suggest backstory Every line of dialogue should be significant. The writer needs to be clear about what the character's agenda is for saying every single line of dialogue that they speak. Do not spoon-feed the audience (or other characters) with trash. A line of dialogue is related directly to a character's emotional make-up, which is related directly to the character's motivation, which is related directly to the momentum of the narrative, which is related directly to the whole script. As Mal Young said on the "Making It At Holby" documentary which you all watched, you can have the most interesting and exciting story in the world but if the audience doesn't care about the characters then it simply won't make any difference.
To check that your dialogue works you'll need to perform it. If you have problems saying it so would an actor.
Part 1: Audience / Theme / Character
Part 2: Subject / Longevity / Copyright / Location
Part 3
Part 4: Duration / Format/ Submissions / Checklist
Part 5: BBC & C4 / Prodco / Next / Rejection / Acceptance / Agents