Preheat oven to 350°.
Drain beans in a colander over a bowl, reserving 1 cup liquid. Set the beans and liquid aside.
Cook bacon in a large nonstick skillet over medium heat until crisp. Remove bacon from pan, reserving 3 tablespoons drippings in pan. Crumble bacon. Add onion to drippings in pan, and cook 10 minutes over medium heat or until golden brown, stirring frequently. Stir in bacon, sugar, and remaining ingredients; cook over medium-low heat until thick and bubbly (about 15 minutes), stirring occasionally.
Combine beans, reserved bean liquid, and the onion mixture in a 3-quart casserole coated with cooking spray. Cover and bake at 350° 45 minutes, stirring every 15 minutes.