iCloud is primarily syncing storage. If you're using external storage too I don't know if iCloud would accommodate that as part of optimizing storage on your computer.
How to free up storage space on your Mac - https://support.apple.com/HT206996
Optimized Storage [macOS Sierra or later] helps you save storage space space by storing your content in iCloud and making it available on demand:
- When storage space is needed, files, photos, movies, email attachments, and other files that you seldom use are stored in iCloud automatically.
- Each file stays right where you last saved it, and downloads when you open it.
- Files that you’ve used recently remain on your Mac, along with optimized versions of your photos.
Also realize that the standard iCloud storage limit is 2 TB which is short of your 4TB. You can get 4 TB but this has to be part of a larger subscription package and I don't know if this is worth all the trouble. You have to do it by having a subscription to Apple One and buying more storage.
"Upgrade your iCloud storage plan" --> https://support.apple.com/HT201318
"Apple One
With Apple One, you can choose a subscription plan that includes 50GB, 200GB, or 2TB of iCloud storage. If you need more iCloud storage, you can buy more for a total of up to 4TB."
Cost depends upon what kind of Apple One plan you get.
You'll have to assemble all this information using these links:
https://support.apple.com/HT211659 for a list of Apple One plans and included features
and
https://www.apple.com/apple-one/ Apple One cost at the very bottom.
and
iCloud storage plans and pricing - https://support.apple.com/HT201238 - cost and regional availability of upgrades.