I don't think it is possible to draw a polygon around a town boundary automatically; you need to know the coordinates of the corners, and then you draw a polygon connecting those points (so the information about where the town boundaries are doesn't come from Google Maps, but from your application).
Then, you can create a polygon like so:
var polygon = new GPolygon([
new GLatLng(lat, lon - lonOffset),
new GLatLng(lat + latOffset, lon),
new GLatLng(lat, lon + lonOffset),
new GLatLng(lat - latOffset, lon),
new GLatLng(lat, lon - lonOffset)
], "#f33f00", 5, 1, "#ff0000", 0.2);
map.addOverlay(polygon);
(Example code taken from the API docs.)