If your Student visa remains valid then yes you can use it either to remain in the UK or travel back into the UK up until its expiry date.
If your Student visa is no longer valid or it has expired you will need to apply for a Visitor visa (see below).
The Home Office and UK Border Force have told us that returning to the UK for the purposes of attending your graduation ceremony is a valid reason for using your Student visa to re-enter even after your course is finished.
We recommend that you bring proof of the fact that you will be attending your graduation with you, for example, confirmation of your booking, when coming through the UK border, in case you are asked for evidence of your reason for travelling to the UK.
UK Border Force officials may also ask you for further information about your trip to the UK including where you plan to stay and when you plan to leave.
Students who have finished their course earlier than anticipated
If you have finished your degree earlier than originally expected, for example, because you didn't undertake a year in industry that was included on the original CAS we issued you, then you will not be granted re-entry to the UK after you have completed your degree.
The Student Administration team will email you to confirm that you are an 'early finisher' and that we have reported this to the UKVI who will then take steps to cancel your visa.
This report will be made shortly after the release of your final marks. Therefore if you are an 'early finisher' and you want to use your Student visa to re-enter the UK to attend your graduation ceremony (or for any other reason) then you are advised to return before the release of your final marks. If you are unable to do so, then you must apply for a Visitor visa (see below).