WSUS clean up sometime takes really long time and fail.
I like to explain how you can automate the process so there will be not much to clean up so clean up process will run faster.
You can run the gui version of the WSUS server cleanup or run a powershell script.
On wsus server, open PowerShell in admin mode and run
Get-WsusServer | Invoke-WsusServerCleanup -CleanupObsoleteComputers -CleanupObsoleteUpdates -CleanupUnneededContentFiles -CompressUpdates -DeclineExpiredUpdates -DeclineSupersededUpdates
Yes you can save it and run it from the task manager! run it daily or weekly.
While the clean up job runs, "Wsus Service" service will be stopped, and automatically started when the clean up job ends. Do not start it manually, it will extend the clean up time.
If the clean up job runs too long and fail, your best option is to rebuild the wsus.
After you rebuild the wsus and if you are using SCUP and got errors like "xxxxx not found on WSUS SMS_WSUS_CONFIGURATION_MANAGER " on WSyncMgr.log while WSUS try to sync, see this blog