Starting with iOS 9, Apple began providing Wi-Fi Assist on all cellular devices. Wi-Fi Assist is designed to allow your iPhone to automatically switch from Wi-Fi to your cellular data network if it detects a dip in Wi-Fi signal strength.
While this seems like a completely reasonable service to provide users, it may not be in your best interest, especially if you have a capped data plan.
Wi-Fi Assist is turned on by default, so you may notice your phone switching to your data plan, even when you would prefer it to stay connected to Wi-Fi.
To find the Wi-Fi Assist setting, go to Settings >> Cellular and scroll all the way to the bottom. Turn off Wi-Fi Assist to make sure your iPhone stays connected to Wi-Fi when available.