The System of National Accounts (SNA) is the international standard regarding measurement and dissemination of National Accounts. It is produced by the United Nations. It's latest edition is 2008.
Chapter 14 in this manual provides a very detailed account of who and how these statistics are obtained. A summary is shown in the image below:

As the document states:
Data for national accounts come from three main sources:
a) Administrative records;
b) Statistical methods: data obtained by extrapolating survey results on the basis of a benchmark census, a complete enumeration of the entire population;
c) Estimation methods in the national accounts departments.
Regarding administrative records, these come from:
a) Government revenue and expenditure statistics (traditionally compiled by the ministry of finance on government budget);
b) Foreign trade statistics (i.e., exports and imports of goods through customs);
c) Money and banking statistics (traditionally compiled by the central bank);
d) Report on insurance companies by the insurance regulatory authority;
e) Tax records, with limited information on sales, cost of sales and income (processed by tax authority);
f) Business accounts of publicly traded corporations submitted to the stock exchange regulation commission.
Data from statistical methods are based on census and surveys. So in effect, National Accounts do not include a sample of every single firm/household. As the document states:
Surveys are based on a scientifically selected random sample from a population. Data for the
population is obtained by blowing up the sample data by extrapolating the sample size to the
population size.
Finally, estimation is also used to produce national accounts:
There are three methods of estimation in national accounts for data that are not available in administrative records, censuses or surveys:
a) Balancing item method;
b) Commodity flow method;
c) Benchmark ratio method.
You can read more about these issues on the aforementioned chapter.