You can stay for 4-6 months in UK after your course is finished. PHD students can stay for 1 year after their course completion.