Layer 1/3 of the potatoes, 1/3 of the onions, and dot with 1 tablespoon of butter. Repeat layers twice.
In a saucepan, melt remaining butter over medium heat. Whisk in flour until smooth. Gradually whisk in milk until thickened. Stir in cheese until melted. Season with salt and pepper.
Pour cheese sauce over potatoes. Cover and cook on low for 5-6 hours or on high for 2-3 hours, or until potatoes are tender.
Notes
For a richer flavor, use heavy cream instead of milk. You can also add a pinch of nutmeg to the cheese sauce.