Set entity reference revision field value?
You need to store also the revision id, see Programmatically append multiple paragraphs to entity reference field on node.

Or simply set an entity, from which the field can get the data it needs in both cases:

$node-&gt;field_test_entity_reference-&gt;entity = $target_node;
$node-&gt;field_test_entity_revision-&gt;entity = $target_node;
$node-&gt;save();