The 49ers agreed to a three-year contract with running back and special teams stand-out Raheem Mostert on Friday, according to his agent Brett Tessler.