Through keeping Shabbos a person draws the light of Moshiach upon himself;
also through teshuvah.
Sefer HaMidos, The Messiah, Part I §5