Background Sleep plays a pivotal role in children's mental and physical development and has been linked to the gut microbiota in animals and adults. However, the characteristics of the gut microbiota and metabolites and the relationship to late bedtimes in children remain unclear. Methods In total, 88 eligible children, aged from 3 to 8 years, were recruited and divided into two groups according to the bedtime collected by designed questionnaires (early, before 22:00: n = 48; late, after 22:00, n = 40). Stools and plasma samples were collected to examine the characteristics of the gut microbiota and metabolites by shotgun metagenomics and metabolomics. Results The richness and diversity of the gut microbiota in children with early bedtime were significantly increased compared with the late ones. Coprococcus, Collinsella, Akkermansia muciniphila, and Bifidobacterium adolescentis were significantly more abundant in children with early bedtime, while Bacteroides and Clostridium sp. CAG-253 were obviously enriched in the late ones. A total of 106 metabolic pathways, including biosynthesis of ribonucleotide, peptidoglycan, and amino acids, and starch degradation were enriched in children with early bedtime, while 42 pathways were abundant in those with late bedtime. Notably, more gut microbial metabolites were observed in children with late bedtime, which included aldehyde, ketones, esters, amino acids and their metabolites, benzene and substituted derivatives, bile acids, heterocyclic compounds, nucleotide and metabolites, organic acid and derivatives, sugars and acyl carnitine. In plasma, fatty amides, lipids, amino acids, metabolites, hormones, and related compounds were enriched in children with early bedtime, while bile acids were higher in children with late bedtime. Association studies revealed that the different microbial species were correlated with metabolites from gut microbiota and plasma. Conclusions The results of our study revealed that the gut microbiota diversity and richness, and metabolic pathways were significantly extensive in children with early bedtime, whereas the gut microbial metabolites were significantly decreased, which might be related to gut microbial differences.