Finding the convex hull of a collection of points is a studied problem, so you can use an existing solution:
http://en.wikipedia.org/wiki/Convex_hull_algorithms
Alternatively, willvarfar's approach is faster for large n, but the polygon won't be as pretty.