"all day" is acting as an adverb, giving us more information about "raining".
To show the pattern, here's an alternative adverb.
it was raining heavily so I stayed in doors.
The differences between the three phrases are to do with the tenses. Try each phrase without the all day:
It rained yesterday so I stayed indoors
It was raining yesterday so I stayed indoors
These two work without the "all day", but adding "all day" intensifies the feeling, the rain was occurring all day, no opportunity to go out.
It had been raining yesterday
Without the "all day" has a feeling of incompleteness, a sense that the rain stopped after some time. So adding "all day" strongly clarifies that there was rain for the entire day.