No. He's not doing it for attention. When mine throw up during the night, it's either to hork up something they shouldn't have eaten, such a pieces of stick, a sock, stuff like that, or they're sick. Some dogs throw up some phlegm/bile during the night due to something people refer to as empty tummy or stomach syndrome. This seems to be due to too long a wait between dinner and breakfast the next morning and is often resolved or improved with a snack before bedtime.