Drain potatoes and place back in saucepan. Mash with butter and milk. Add sour cream, onion (if desired), salt and pepper. Spoon into a buttered pyrex baking dish and cover with the grated cheese.
Bake in a 350 degree oven until the cheese is melted and golden brown, about 20 minutes.
NOTE: These potatoes may be made ahead of time, and refrigerated. Heat covered for a few minutes, then uncover and add cheese and bake until golden brown.