Low-expansion foam is the most common way to air-seal windows, but in my experience it doesn't work as well as backer rod and caulk. The main reason is that when we air-seal, we are also sealing for water. Foam (even if it's installed carefully, which it often is not) is a closed-cell product and reportedly water-proof. But in my experience it does not remain flexible for very long, and can separate from the wood at the edges if the framing shrinks, as it often does over time as the lumber dries.

Using caulk doesn't take that much more time and is not more expensive. But it does take a little more attention. The pay-off is a seal that will last longer, and will be less likely to leak, particularly at the sill where water is most likely to back up and spill into the interior.

The array of tools and materials my crew uses to air-seal windows: It's not a huge investment, but surprisingly few builders have much more than a low-cost caulk gun in their truck.
The array of tools and materials my crew uses to air-seal windows: It's not a huge investment, but surprisingly few builders have much more than a low-cost caulk gun in their truck.

Below are links to the sealant and backer rod we typically use, and a few of the the rock-solid tools that have lasted for my crew better than others we've tried.

Newborn Model 250 Caulking Guns are the best caulk guns I’ve found. I like being able to cut the end of the tube (shown above) and piercing it with the unboard wire, rather than using a utility knife and searching for a piece of Romex each time I change tubes.
Newborn Model 250 Caulking Guns are the best caulk guns I’ve found. I like being able to cut the end of the tube (shown above) and piercing it with the unboard wire, rather than using a utility knife and searching for a piece of Romex each time I change tubes.
DAP Dynaflex 230 Caulk works well and is not crazy expensive. Assume roughly two tubes per average window.
DAP Dynaflex 230 Caulk works well and is not crazy expensive. Assume roughly two tubes per average window.
Albion Caulking Spatula Set  is a great investment. Spatulas work well to smooth out the bead and ensure consistent coverage over the backer rod. (They also will come in handy for detailing fluid-applied weather barriers).
Albion Caulking Spatula Set is a great investment. Spatulas work well to smooth out the bead and ensure consistent coverage over the backer rod. (They also will come in handy for detailing fluid-applied weather barriers).
Backer Rod:  Order sizes bigger than you think you’ll need as it compresses easily and you won't enough to fully seal the gap around the window.
Backer Rod: Order sizes bigger than you think you’ll need as it compresses easily and you won't enough to fully seal the gap around the window.