sort post types by amount of views

WP post views plugin already does this job very well.

So just install that plugin , then use function like this

<?php if (function_exists('get_most_viewed')): ?>
    <ul>
        <?php get_most_viewed('custom post type name',20); ?>
    </ul>
<?php endif; ?>

For more info, check this FAQ page

tech