A new route for the synthesis of quinazolin-2,4(1H,3H)-diones and thieno [2,3-d]pyrimidine-2,4(1H,3H)-diones substituted by pyridyl/quinolinyl moiety in position 3 has been developed. The proposed method concluded in an annulation of substituted anthranilic esters or 2-aminothiophene-3-carboxylates with 1,1-dimethyl-3-(pyridin-2-yl) ureas. The process consists of the formation of N-aryl-N'-pyridyl ureas followed by their cyclocondensation into the corresponding fused heterocycles. The reaction does not require the use of metal catalysts and proceeds with moderate to good yields (up to 89%). The scope of the method is more than 30 examples, including compounds with both electron-withdrawing and electron-donating groups, as well as diverse functionalities. At the same time, strong electron-acceptor substituents in the pyridine ring of the starting ureas reduce the product yield or even prevent the cyclocondensation step. The reaction can be easily scaled to gram quantities.