10 U.S. Code § 509 - Voluntary extension of enlistments: periods and benefits

(a)
Under such regulations as the Secretary concerned may prescribe, the term of enlistment of a member of an armed force may be extended or reextended with his written consent for any period. However, the total of all such extensions of an enlistment may not exceed four years.
(b)
When a member is discharged from an enlistment that has been extended under this section, he has the same rights, privileges, and benefits that he would have if discharged at the same time from an enlistment not so extended.

The following state regulations pages link to this page.