Yes of course. In fact it is mentioned in many Hadeeths from the Prophet Muhammad (SAWA) and his Holy Progeny Ahlul Bayt (AS) that it is recommended to fast any number of days or the whole month of Rajab and any number of days or the whole month of Sha'ban for those who can, and for those who can not fast the whole month, then to fast any number of days in Rajab and Sha'ban. The Prophet (SAWA) himself used to fast the whole month of Sha'ban and used to link it with fasting of the month of Ramadhan.
Wassalam.
Wassalam.