The actual relief for main residences is in section 223(1) :
"No part of a gain to which section 222 applies shall be a chargeable gain if the dwelling-house or part of a dwelling-house has been the individual’s only or main residence throughout the period of ownership, or throughout the period of ownership except for all or any part of the last 36 months of that period."
That gives a complete relief from all CGT where the house has been the main residence for all the time that it has been owned, although there is an exemption for the last 36 months on the basis that you may have moved out and been unable to sell the house for a while.
Subsection 223(2) tells you what to do if you live in the house for less than the full period of owndership:
Where subsection (1) above does not apply, a fraction of the gain shall not be a chargeable gain, and that fraction shall be—
(a) the length of the part or parts of the period of ownership during which the dwelling-house or the part of the dwelling-house was the individual’s only or main residence, but inclusive of the last 36 months of the period of ownership in any event, divided by
(b) the length of the period of ownership.
so it gets treated as your main residence for the last 36 months of ownership in any event, but you have to pay tax on that proportion of the gain equal to the ratio of the period of ownership before the last 36 months to the total period of ownership.
As a matter of law, your main residence is by default decided by the facts - where you spend most of your time, where you are registered to vote, registered as a company director, where your family live, but if you want to clarify the matter section 222(5) is your friend:
So far as it is necessary for the purposes of this section to determine which of 2 or more residences is an individual’s main residence for any period—
(a) the individual may conclude that question by notice to the inspector given within 2 years from the beginning of that period but subject to a right to vary that notice by a further notice to the inspector as respects any period beginning not earlier than 2 years before the giving of the further notice,
(b) subject to paragraph (a) above, the question shall be concluded by the determination of the inspector, which may be as respects the whole or specified parts of the period of ownership in question
which is great, but it only lets you go back one financial year. If you wanted to give notice of a change of main residence today (13 May 2009), you could only make that effective from 6 April 2008 (6 April 2007 is more than 2 years ago), so don't think that you can tell the tax man that it was always your main residence. It gets treated as your main residence for the last 36 months anyway, so giving notice after the sale makes no difference.
So if you want to claim a CGT exemption for the home on which you claim second home partliamentary allownces, you can do so by notifying HMRC when you buy the second property, but if you think you can get away with it by your normal parliamentary bluster you have as much chance as Gordon Brown has of going down in history as a world statesman.