Custom post type and taxonomy – show related posts

You’re running a separate query for every tag, which aside from being wasteful is also causing the repeat posts. You should rewrite the code to make only one query that looks for all tags. Try something along the lines of this:

<?php

// Generate an array of taxonomy IDs
$tax_IDs = array();
foreach ($tags as $tag) {
    $tax_IDs[] = $tag->ID;
}

// Use your array of taxonomy IDs in the query args
$args = array(
  'post_type' => 'your_custom_post_type',
  'post__not_in' => array($post->ID),
  'showposts'=> 3,
  'tax_query' => array(
        array(
            'taxonomy' => 'your_custom_taxonomy',
            'field' => 'id',
            'terms' => $tax_IDs
        )
    )
);

// Run your query
$my_query = new WP_Query($args);

?>