Extra mana
Following are specific sections from the comprehensive rulebook that address your primary question (emphasis added).
106.4. When an effect produces mana, that mana goes into a player’s mana pool. From there, it can be used to pay costs immediately, or it can stay in the player’s mana pool. Each player’s mana pool empties at the end of each step and phase.
106.4a If a player passes priority (see rule 116) while there is mana in his or her mana pool, that player announces what mana is there. If any mana remains in a player’s mana pool after he or she spends mana to pay a cost, that player announces what mana is still there.
As previous answers have said, there is nothing that prevents you from producing more mana than you are capable of spending. The extra mana will stay in your mana pool until the next end step or phase.
Rolling back
When to reverse past actions
A game can only be reversed if it is put into an error state. A player cannot choose to roll back the game because they forgot to take an action such as using all of the mana pool. Since producing mana that you cannot use is not an illegal action, play will proceed as normal.
Illegal actions
To answer your secondary question of what to do when you find yourself about to/just have taken an action that actual is illegal, the entire action must be reversed and payments made are cancelled.
Tournament rules
In a tournament game, judges will be present to help ensure that the games are played according to the rulebook. Players will be held accountable and can be issued penalties for putting the game into an illegal state. However, it is the shared responsibility of all players in a game to make sure that no illegal actions are allowed to occur.
Casual games
Casual games are not necessarily subject to the strict interpretation of the comprehensive rules when all participants are in agreement as to how loose the rules can be followed. When playing with friends or people of different skill levels, the rules can be relaxed to promote a potentially more enjoyable game. However, a player that makes a mistake is still at the mercy of their opponents if leniency is requested.
In short
Your friend is correct that it is your responsibility to keep track of your mana pool. Of course as long as this isn't a officially judged game, different people may give you different amounts of leeway until you become experienced.