diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
index 8c0c376..e4804ca 100644
--- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
+++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php
@@ -365,6 +365,32 @@ public function preSave(EntityStorageInterface $storage) {
   /**
    * {@inheritdoc}
    */
+  public function __sleep() {
+    $keys_to_unset = [];
+    if ($this instanceof EntityWithPluginCollectionInterface) {
+      $vars = get_object_vars($this);
+      foreach ($this->getPluginCollections() as $plugin_config_key => $plugin_collection) {
+        // Save any changes to the plugin configuration to the entity.
+        $this->set($plugin_config_key, $plugin_collection->getConfiguration());
+        // If the plugin collections are stored as properties on the entity,
+        // mark them to be unset.
+        $keys_to_unset += array_filter($vars, function ($value) use ($plugin_collection) {
+          return $plugin_collection === $value;
+        });
+      }
+    }
+
+    $vars = parent::__sleep();
+
+    if (!empty($keys_to_unset)) {
+      $vars = array_diff($vars, array_keys($keys_to_unset));
+    }
+    return $vars;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
   public function calculateDependencies() {
     // All dependencies should be recalculated on every save apart from enforced
     // dependencies. This ensures stale dependencies are never saved.
diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
index feca9e9..4710765 100644
--- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
@@ -7,8 +7,11 @@
 
 namespace Drupal\Tests\Core\Config\Entity;
 
+use Drupal\Component\Plugin\PluginManagerInterface;
 use Drupal\Core\DependencyInjection\ContainerBuilder;
 use Drupal\Core\Language\Language;
+use Drupal\Core\Plugin\DefaultLazyPluginCollection;
+use Drupal\Tests\Core\Config\Entity\Fixtures\ConfigEntityBaseWithPluginCollections;
 use Drupal\Tests\Core\Plugin\Fixtures\TestConfigurablePlugin;
 use Drupal\Tests\UnitTestCase;
 
@@ -308,6 +311,36 @@ public function testCalculateDependenciesWithThirdPartySettings() {
   }
 
   /**
+   * @covers ::__sleep
+   */
+  public function testSleepWithPluginCollections() {
+    $instance_id = 'the_instance_id';
+    $instance = new TestConfigurablePlugin([], $instance_id, []);
+
+    $plugin_manager = $this->prophesize(PluginManagerInterface::class);
+    $plugin_manager->createInstance($instance_id, ['id' => $instance_id])->willReturn($instance);
+
+    $entity_values = ['the_plugin_collection_config' => [$instance_id => ['foo' => 'original_value']]];
+    $entity = new TestConfigEntityWithPluginCollections($entity_values, $this->entityTypeId);
+    $entity->setPluginManager($plugin_manager->reveal());
+
+    // After creating the entity, change the plugin configuration.
+    $instance->setConfiguration(['foo' => 'new_value']);
+
+    // After changing the plugin configuration, the entity still has the
+    // original value.
+    $expected_plugin_config = [$instance_id => ['foo' => 'original_value']];
+    $this->assertSame($expected_plugin_config, $entity->get('the_plugin_collection_config'));
+
+    // Ensure the plugin collection is not stored.
+    $this->assertNotContains('pluginCollection', $entity->__sleep());
+
+    $expected_plugin_config = [$instance_id => ['foo' => 'new_value']];
+    // Ensure the updated values are stored in the entity.
+    $this->assertSame($expected_plugin_config, $entity->get('the_plugin_collection_config'));
+  }
+
+  /**
    * @covers ::setOriginalId
    * @covers ::getOriginalId
    */
@@ -579,3 +612,20 @@ public function testThirdPartySettings() {
   }
 
 }
+
+class TestConfigEntityWithPluginCollections extends ConfigEntityBaseWithPluginCollections {
+
+  protected $pluginCollection;
+
+  public function setPluginManager(PluginManagerInterface $plugin_manager) {
+    $this->pluginCollection = new DefaultLazyPluginCollection($plugin_manager, ['the_instance_id' => ['id' => 'the_instance_id']]);
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getPluginCollections() {
+    return ['the_plugin_collection_config' => $this->pluginCollection];
+  }
+
+}
