Preheat the oven to 375 degrees F and lightly spray a 2-quart oven-safe casserole dish with nonstick cooking spray. Set aside.
Bring a large pot of water to a boil and cook the pasta until al dente, following the directions on the pasta package. (You'll want it to still have a bite to it because it will finish cooking in the oven.) Drain well.
Meanwhile, in a large skillet, melt the butter over medium-high heat. Whisk in the flour and cook, whisking vigorously, 1 to 2 minutes. Continue to whisk as you add the milk, then let the mixture gently come to a simmer and thicken, about 5 minutes.
Add the Cheddar and gruyere and stir together with a spatula until all the cheese has melted. Add salt and pepper to taste. Remove the skillet from the heat.
Add the pasta to the cheese sauce and gently toss until everything is covered. Sprinkle half the bacon into the skillet and toss to incorporate. Pour the pasta mixture into the prepared casserole dish. Top with the remainder of the bacon, then bake, uncovered, until the mixture is bubbly and the pasta is cooked through, 30 minutes. Remove from the oven and let sit for 10 minutes before serving.