Render custom block using block.html.twig template
BlockContent is the only entity in Drupal not having a template of its own. So you have to wrap it in a template yourself:

$block = \Drupal\block_content\Entity\BlockContent::load($bid);
if ($block) {
  $content = \Drupal::entityTypeManager()-&gt;getViewBuilder('block_content')-&gt;view($block);
  $build = [
    '#theme' =&gt; 'block',
    '#attributes' =&gt; [],
    '#configuration' =&gt; ['label' =&gt; 'My Block', 'label_display' =&gt; 'visible'],
    '#base_plugin_id' =&gt; 'block_content',
    '#plugin_id' =&gt; 'block_content:' . $block-&gt;uuid(),
    '#derivative_plugin_id' =&gt; $block-&gt;uuid(),
    '#id' =&gt; $block-&gt;id(),
    'content' =&gt; $content,
  ];
  return $build;
}