If you have a two-year visa that does not mean that you have to return to your home country at the end of two years. You may stay for as long as necessary in order to finish your education in the US. The length of the visa refers to how long you have to cross the border into the US.