Pilling often occurs due to friction during wear and washing. To prevent this, wash your flannel shirts inside out on a gentle cycle, and avoid washing them with heavy items that can cause friction.