>> "I want my pic16f628 to sleep for the nigh(at least 6 hours). "

SLEEP 21600

see SLEEP command in Manual

>> "...there is one switch state that I want my pic to remember even if the power fails"

use the 16F628's integral EEPROM...

see WRITE, READ and DATA in the Manual