Insulate. If you spent a lot of money getting the most efficient windows you could afford, don't let the heat escape all around their sides.
If you've ever used a can of foam, however, you know it can be a tricky, messy process, and some is inevitably wasted when the can dries up. So if you have a lot of foaming to do, invest in a foam gun. The foam doesn't dry out, and you can control the flow rate, which means the application process will be less messy and less wasteful.