Yes, you can. You need to talk your International student advisor or DSO and get it approved. Also, you need to work with your Academic department about your break and get approvals. It is not a complicated process, you just need to talk to them and get approved. DSO will update your SEVIS records to reflect the same.
About 5 years for MS, it depends on school. Some schools have even longer durations. Just check the academic webiste or call the Graduate school office.