Setting multiple checkbox values with form_set_value
I believe you want to pass an array with all values to form_set_value() as the function is setting the value, not appending to it. I would alter your setup to build an array of values with your switch/foreach block and then pass that array in a single form_set_value call below the switch, outside of the foreach.

Update your your foreach / switch like so:

$host_values = [];
foreach($hosts as $host){
  switch($host-&gt;alias){
    case "external":
      $host_values[] = ['tid' =&gt; '758'];
      break;
    case "internal":
      $host_values[] = ['tid' =&gt; '759']
      break;
    case "local":
      $host_values[] = ['tid' =&gt; '760']
      break;
    default:
      break;
  }
}

form_set_value($form['field_proxy_host'], [LANGUAGE_NONE =&gt; $host_values], $form_state);