From the end of World War II until 2011 the parliamentary term was 5 years or less: the Prime Minister of the day could request a parliamentary dissolution (in other words call a general election before the full five years were up).

The 2011 Fixed Term Parliament Act set the length of a parliament for a UK Government in Westminster, and for all future UK Governments, at no more and no less than 5 years.

More Info: en.wikipedia.org