Damien Young was sentenced Monday after earlier pleading guilty to sneaking the gun onto a US Airways flight from Philadelphia to Phoenix.
Young was helped by his roommate, an airline employee who authorities say switched bags with Young at the gate to bypass security.
Authorities say Young was moving to Arizona and thought it would be easier to smuggle the gun than to follow proper notification procedures. Young had a permit for the weapon, which was registered to him.
A passenger notified airline officials after noticing the men's suspicious behavior. The plane was stopped as it taxied out for takeoff.