Your iPhone needs enough space to store every photo you have in iCloud Photo Library. If your iPhone doesn't have enough space to store every photo, the sync will fail. You can enable “Optimize iPhone Storage” to store smaller versions of your photos on your iPhone, with the full-resolution versions stored in iCloud. Your iPhone will still need enough space to store a smaller version of every photo in your iCloud Photo Library to successfully sync, even with this setting enabled. Here’s how you enable it:
- Tap Settings > [your name] > iCloud > Photos.
- Select Optimize iPhone Storage to save space on your device.
An alternative option is to archive or make copies of some of the photos you have in iCloud Photo Library on a Mac or PC, then delete them from iCloud Photo Library. You will not be able to view these archived photos from the Photos app on your iPhone. You can learn how to archive photos here: Archive or make copies of the information you store in iCloud - Apple Support