Sometimes you'll hear people claim that there are no rules for how to punctuate English sentences. And if you come up with a useless enough definition for "rule", this is certainly true. No one is forcing you at gunpoint to write your sentences the same way everyone else does.
In fact, even among people who follow the standard conventions, there is quite a bit of variation. One writer might use more commas than another, or use just as many but put them in different places. To a certain extent, it certainly makes sense to characterize these choices as a matter of style.
But, It's, also true, that there!!! are, things, pretty, much, no;;;;;;one, does, with, punctuation,,, ,,,
Why not? Well, punctuation arose as a mechanism to represent things like pauses or question intonation in spoken language. That is, it didn't have any conventions independent of spoken language; it merely reflected the way the words were intended to be pronounced when they were read aloud. Punctuation was certainly not random, but there were no rules apart from "write it the way you'd say it".
To a certain extent, this is still true today. Commas sometimes still line up with pauses in speech, for example. But often, they no longer do. Punctuation conventions have changed in ways that don't necessarily line up with the way the language is spoken, and an independent description is now required. Unfortunately, many linguists ignore the written language entirely, so there are very few fully descriptive approaches to punctuation.
In 1990, Geoffrey Nunberg published his monograph, The Linguistics of Punctuation, a descriptive approach to punctuation. He went on to co-author chapter 20 of The Cambridge Grammar of the English Language (2002) with Ted Briscoe and Rodney Huddleston, titled Punctuation. The former is a fairly lengthy attempt to characterize the punctuation conventions of English today as a set of formalized rules. The latter is an informal description, possibly more accessible but, of course, it is only a chapter in length and isn't truly comprehensive.
From a descriptive linguist's point of view, the "rules" are those patterns we can find in a corpus of natural language which fit our expectations as speakers of Standard English, and Nunberg's work takes that same idea and applies it to the written language. With this definition of "rule" in mind, yes, there are rules, but there's a lot of room for future work to be done. Unfortunately, we don't have any truly comprehensive description of English punctuation yet.
For a more historical perspective, I would like to recommend Pause and Effect: Punctuation in the West (1993) by M. B. Parkes, but it's unfortunately very hard to find. This book will show you how punctuation evolved from its original role of representing speech to the way it's used today.
I don't know of any descriptions of punctuation which are both accurate and written to be accessible to learners of English. There are plenty of books telling you how to punctuate things, but a lot of them present "rules" that are commonly broken by good writers, so they're not really rules at all. Accurate description is hard work! Personally, I recommend you keep doing what you've been doing – picking up punctuation conventions naturally rather than reading about them. It seems to be working out well for you.