Preheat oven to 375°F Coat a 2-quart covered baking dish with cooking spray.
Melt butter in a large pot over medium heat. Add onion and cook, stirring occasionally, until onion begins to brown, about 5 minutes. Stir in flour; add milk slowly, stirring. Add potatoes and stir to mix. Bring to a boil. Stir in 3/4 cup of cheese, salt and pepper.
Pour mixture into prepared baking dish and level out surface. Bake for 1 hour, uncovered. Cover and bake until potatoes are fork-tender, about 20 minutes more.
Change oven temperature to broil. Sprinkle remaining cheese over potatoes. Broil 6 inches from the heating element until the cheese is golden brown, about 1 to 2 minutes. Allow to cool for 5 minutes before slicing into 8 pieces.