Either way is fine. The "rules" regarding this are a bit irregular.
「間{かん}」 optional with:
秒、分、日、月、年
「間」 needed with:
時、週
This is because for instance, 1時 and 1時間 mean completely different things -- "1 o'clock" and "one hour", respectively.
We say something like 「3週連続で」 ("for three consecutive weeks") without a 「間」 as a set phrase, but 「第三週」 means "the third week of a month". Thus, to refer specifically to a period of 3 weeks, we say 「3週間」 virtually every time.
Thus, the sentence:
「私はもう六ヶ月(間)ぐらい日本語を勉強しています。」
= "I have already been studying Japanese for about 6 months."
is correct with or without a 「間」. With it, it sounds slightly more 'formal' or "official", but the difference is not that great.
And the noun phrase:
「ジルと暮らした四ヶ月間(間)」
= "The 4 months that I lived with Jill."
is also correct with or without the 「間」. This is not a sentence. 「ジルと暮らした」 is a relative clause that modifies the 「四ヶ月間」.